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
bfff9647
Commit
bfff9647
authored
Sep 06, 2018
by
徐丛奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aaaaaaaaaa
parent
4b2dde41
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
385 additions
and
320 deletions
+385
-320
EyeSettingActivity.java
app/src/main/java/com/oo/eye/activity/EyeSettingActivity.java
+1
-1
EyeTestActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
+70
-21
SinglePeopleTestActivity.java
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
+2
-1
ClassBean.java
app/src/main/java/com/oo/eye/bean/ClassBean.java
+62
-3
GradeBean.java
app/src/main/java/com/oo/eye/bean/GradeBean.java
+20
-2
Request.java
app/src/main/java/com/oo/eye/bean/Request.java
+43
-0
SchoolBean.java
app/src/main/java/com/oo/eye/bean/SchoolBean.java
+145
-0
PresenterFactory.java
app/src/main/java/com/oo/eye/mvp/PresenterFactory.java
+0
-27
EyeHistroyContract.java
app/src/main/java/com/oo/eye/mvp/contract/EyeHistroyContract.java
+0
-24
EyeMainContract.java
app/src/main/java/com/oo/eye/mvp/contract/EyeMainContract.java
+0
-23
EyeTestContract.java
app/src/main/java/com/oo/eye/mvp/contract/EyeTestContract.java
+0
-23
EyeHistroyPresenter.java
app/src/main/java/com/oo/eye/mvp/presenter/EyeHistroyPresenter.java
+0
-45
EyeMainPresenter.java
app/src/main/java/com/oo/eye/mvp/presenter/EyeMainPresenter.java
+0
-77
EyeTestPresenter.java
app/src/main/java/com/oo/eye/mvp/presenter/EyeTestPresenter.java
+0
-59
EyeApiService.java
app/src/main/java/com/oo/eye/net/EyeApiService.java
+8
-8
EyeDataManager.java
app/src/main/java/com/oo/eye/net/EyeDataManager.java
+29
-1
NetConfig.java
app/src/main/java/com/oo/eye/net/NetConfig.java
+5
-5
No files found.
app/src/main/java/com/oo/eye/activity/EyeSettingActivity.java
View file @
bfff9647
...
@@ -155,7 +155,7 @@ public class EyeSettingActivity extends BaseActivity {
...
@@ -155,7 +155,7 @@ public class EyeSettingActivity extends BaseActivity {
}
}
});
});
//测视等待时长
//测视等待时长
int
wait
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_WAIT_SETTING_KEY
,
5
);
int
wait
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_WAIT_SETTING_KEY
,
0
);
switch
(
wait
)
{
switch
(
wait
)
{
case
3
:
case
3
:
mCheckboxWait3
.
setChecked
(
true
);
mCheckboxWait3
.
setChecked
(
true
);
...
...
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
View file @
bfff9647
package
com
.
oo
.
eye
.
activity
;
package
com
.
oo
.
eye
.
activity
;
import
android.os.CountDownTimer
;
import
android.os.CountDownTimer
;
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.MotionEvent
;
...
@@ -75,6 +76,7 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -75,6 +76,7 @@ public class EyeTestActivity extends BaseActivity {
private
int
mDistance
=
EyeConfig
.
EYE_DISTANCE_5
;
private
int
mDistance
=
EyeConfig
.
EYE_DISTANCE_5
;
private
int
mDirection
=
EYE_DIRECTION_4
;
private
int
mDirection
=
EYE_DIRECTION_4
;
private
int
mGroupDecimal
=
EyeConfig
.
EYE_SETTING_5
;
private
int
mGroupDecimal
=
EyeConfig
.
EYE_SETTING_5
;
private
int
mAutoJudge
=
0
;
private
ArrayList
<
ArrayList
<
E
>>
mList
=
new
ArrayList
<>();
private
ArrayList
<
ArrayList
<
E
>>
mList
=
new
ArrayList
<>();
private
int
mLocation
;
private
int
mLocation
;
...
@@ -91,6 +93,11 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -91,6 +93,11 @@ public class EyeTestActivity extends BaseActivity {
private
boolean
isStartTest
=
false
;
private
boolean
isStartTest
=
false
;
private
boolean
isKeyDwon
=
false
;
private
boolean
isKeyDwon
=
false
;
private
boolean
isJudgeChoose
=
false
;
private
Handler
mHandler
;
private
Runnable
mRunnable
;
//执行几秒钟默认选择错误的线程
private
boolean
isChoose
=
false
;
private
long
totalTime
=
5000
;
private
long
totalTime
=
5000
;
private
long
intervalTime
=
1000
;
private
long
intervalTime
=
1000
;
...
@@ -109,10 +116,12 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -109,10 +116,12 @@ public class EyeTestActivity extends BaseActivity {
}
}
private
void
initialize
()
{
private
void
initialize
()
{
mHandler
=
new
Handler
();
mStudentList
=
EyeConfig
.
getInstance
().
getStudents
();
mStudentList
=
EyeConfig
.
getInstance
().
getStudents
();
mDistance
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
EyeConfig
.
EYE_DISTANCE_5
);
mDistance
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
EyeConfig
.
EYE_DISTANCE_5
);
mDirection
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_4
);
mDirection
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_4
);
mGroupDecimal
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_5
);
mGroupDecimal
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_5
);
mAutoJudge
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_WAIT_SETTING_KEY
,
0
);
mList
.
clear
();
mList
.
clear
();
for
(
int
i
=
0
;
i
<
14
;
i
++)
{
for
(
int
i
=
0
;
i
<
14
;
i
++)
{
...
@@ -376,26 +385,62 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -376,26 +385,62 @@ public class EyeTestActivity extends BaseActivity {
mEyeText
.
setText
(
levelByIndex
);
mEyeText
.
setText
(
levelByIndex
);
mEyeText_
.
setText
(
""
+
(
mLocation
+
1
));
mEyeText_
.
setText
(
""
+
(
mLocation
+
1
));
drewE
(
mSelectE
);
drewE
(
mSelectE
);
isJudgeChoose
=
false
;
startRunnable
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
private
void
startRunnable
(){
if
(
mRunnable
==
null
){
mRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
LogUtil
.
e
(
"mRunnable------"
);
if
(
isChoose
){
return
;
}
userChooseError
();
}
};
}
if
(
mAutoJudge
>
0
)
{
LogUtil
.
e
(
"开启mRunnable"
);
mHandler
.
postDelayed
(
mRunnable
,
mAutoJudge
*
1000
);
}
isChoose
=
false
;
}
private
void
removeRunnable
(){
isChoose
=
true
;
try
{
if
(
mHandler
!=
null
&&
mRunnable
!=
null
)
{
mHandler
.
removeCallbacks
(
mRunnable
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
/**
/**
* 选择的方向
* 选择的方向
*
*
* @param direct
* @param direct
*/
*/
private
void
userChoose
(
int
direct
)
{
private
synchronized
void
userChoose
(
int
direct
)
{
//获取当前行答过的e
removeRunnable
();
List
<
E
>
list
=
mCollect
.
get
(
mLevelIndex
);
if
(!
isJudgeChoose
)
{
if
(
null
==
list
||
list
.
size
()
==
0
)
{
isJudgeChoose
=
true
;
list
=
new
ArrayList
<>();
//获取当前行答过的e
}
List
<
E
>
list
=
mCollect
.
get
(
mLevelIndex
);
mSelectE
.
setUserChoose
(
direct
);
if
(
null
==
list
||
list
.
size
()
==
0
)
{
list
.
add
(
mSelectE
);
list
=
new
ArrayList
<>();
mCollect
.
put
(
mLevelIndex
,
list
);
}
judge
();
mSelectE
.
setUserChoose
(
direct
);
list
.
add
(
mSelectE
);
mCollect
.
put
(
mLevelIndex
,
list
);
judge
();
}
}
}
private
void
judge
()
{
private
void
judge
()
{
...
@@ -456,17 +501,21 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -456,17 +501,21 @@ public class EyeTestActivity extends BaseActivity {
/**
/**
* 答错
* 答错
*/
*/
private
void
userChooseError
()
{
private
synchronized
void
userChooseError
()
{
int
direct
=
mSelectE
.
getDirect
()
+
1
;
removeRunnable
();
//获取当前行答过的e
if
(!
isJudgeChoose
)
{
List
<
E
>
list
=
mCollect
.
get
(
mLevelIndex
);
isJudgeChoose
=
true
;
if
(
null
==
list
||
list
.
size
()
==
0
)
{
int
direct
=
mSelectE
.
getDirect
()
+
1
;
list
=
new
ArrayList
<>();
//获取当前行答过的e
}
List
<
E
>
list
=
mCollect
.
get
(
mLevelIndex
);
mSelectE
.
setUserChoose
(
direct
);
if
(
null
==
list
||
list
.
size
()
==
0
)
{
list
.
add
(
mSelectE
);
list
=
new
ArrayList
<>();
mCollect
.
put
(
mLevelIndex
,
list
);
}
judge
();
mSelectE
.
setUserChoose
(
direct
);
list
.
add
(
mSelectE
);
mCollect
.
put
(
mLevelIndex
,
list
);
judge
();
}
}
}
...
...
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
View file @
bfff9647
...
@@ -23,7 +23,6 @@ import java.util.List;
...
@@ -23,7 +23,6 @@ import java.util.List;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
butterknife.OnClick
;
import
retrofit2.http.HEAD
;
/**
/**
* Date : 2018/8/28.
* Date : 2018/8/28.
...
@@ -70,6 +69,7 @@ public class SinglePeopleTestActivity extends BaseActivity {
...
@@ -70,6 +69,7 @@ public class SinglePeopleTestActivity extends BaseActivity {
showPopWindow
();
showPopWindow
();
break
;
break
;
case
R
.
id
.
do_search
:
case
R
.
id
.
do_search
:
break
;
break
;
case
R
.
id
.
begin_test
:
case
R
.
id
.
begin_test
:
StudentBean
bean
=
mPeopleAdapter
.
getLastSelectBean
();
StudentBean
bean
=
mPeopleAdapter
.
getLastSelectBean
();
...
@@ -105,4 +105,5 @@ public class SinglePeopleTestActivity extends BaseActivity {
...
@@ -105,4 +105,5 @@ public class SinglePeopleTestActivity extends BaseActivity {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
}
}
app/src/main/java/com/oo/eye/bean/ClassBean.java
View file @
bfff9647
...
@@ -7,8 +7,67 @@ import com.app.baselibrary.bean.BaseBean;
...
@@ -7,8 +7,67 @@ import com.app.baselibrary.bean.BaseBean;
*/
*/
public
class
ClassBean
extends
BaseBean
{
public
class
ClassBean
extends
BaseBean
{
private
String
sid
;
private
String
id
;
private
String
id
;
private
String
gradeId
;
private
String
sid
;
private
String
name
;
private
String
grade
;
private
String
classes
;
private
String
status
;
private
String
orderlist
;
private
String
password
;
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getSid
()
{
return
sid
;
}
public
void
setSid
(
String
sid
)
{
this
.
sid
=
sid
;
}
public
String
getGrade
()
{
return
grade
;
}
public
void
setGrade
(
String
grade
)
{
this
.
grade
=
grade
;
}
public
String
getClasses
()
{
return
classes
;
}
public
void
setClasses
(
String
classes
)
{
this
.
classes
=
classes
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getOrderlist
()
{
return
orderlist
;
}
public
void
setOrderlist
(
String
orderlist
)
{
this
.
orderlist
=
orderlist
;
}
}
}
app/src/main/java/com/oo/eye/bean/GradeBean.java
View file @
bfff9647
...
@@ -2,12 +2,30 @@ package com.oo.eye.bean;
...
@@ -2,12 +2,30 @@ package com.oo.eye.bean;
import
com.app.baselibrary.bean.BaseBean
;
import
com.app.baselibrary.bean.BaseBean
;
import
java.util.List
;
/**
/**
* Created by xucon on 2018/8/31.
* Created by xucon on 2018/8/31.
*/
*/
public
class
GradeBean
extends
BaseBean
{
public
class
GradeBean
extends
BaseBean
{
private
String
sid
;
private
List
<
ClassBean
>
classList
;
private
String
id
;
private
String
name
;
private
String
name
;
public
List
<
ClassBean
>
getClassList
()
{
return
classList
;
}
public
void
setClassList
(
List
<
ClassBean
>
classList
)
{
this
.
classList
=
classList
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
}
app/src/main/java/com/oo/eye/bean/Request.java
0 → 100644
View file @
bfff9647
package
com
.
oo
.
eye
.
bean
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by xucon on 2018/9/6.
*/
public
class
Request
{
private
Map
<
String
,
String
>
params
=
new
HashMap
<>();
private
String
schoolId
;
private
String
classId
;
private
String
grade
;
private
String
studentId
;
private
String
visionStatus
;
//A类:typeA,单眼5.0或以上:singleGood,双眼过5.0或以上:goodVision,任意眼有5.0以下的情况:badVision
private
String
testStatus
;
//为空或不传默认为all 全部:all,已测试:tested,未测试:untested
public
void
setSchoolId
(
String
schoolId
)
{
params
.
put
(
"schoolId"
,
schoolId
);
}
public
void
setClassId
(
String
classId
)
{
params
.
put
(
"classId"
,
classId
);
}
public
void
setGrade
(
String
grade
)
{
params
.
put
(
"grade"
,
grade
);
}
public
void
setStudentId
(
String
studentId
)
{
params
.
put
(
"studentId"
,
studentId
);
}
public
void
setVisionStatus
(
String
visionStatus
)
{
params
.
put
(
"visionStatus"
,
visionStatus
);
}
public
void
setTestStatus
(
String
testStatus
)
{
params
.
put
(
"testStatus"
,
testStatus
);
}
}
app/src/main/java/com/oo/eye/bean/SchoolBean.java
0 → 100644
View file @
bfff9647
package
com
.
oo
.
eye
.
bean
;
import
java.util.List
;
/**
* Created by xucon on 2018/9/6.
*/
public
class
SchoolBean
{
private
String
id
;
private
String
name
;
private
String
address
;
private
String
phone
;
private
String
zipcode
;
private
String
level
;
private
String
province
;
private
String
city
;
private
String
district
;
private
String
status
;
private
String
number
;
private
String
activation_code
;
private
String
contacts
;
private
String
aid
;
private
List
<
GradeBean
>
gradeList
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getZipcode
()
{
return
zipcode
;
}
public
void
setZipcode
(
String
zipcode
)
{
this
.
zipcode
=
zipcode
;
}
public
String
getLevel
()
{
return
level
;
}
public
void
setLevel
(
String
level
)
{
this
.
level
=
level
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
String
getDistrict
()
{
return
district
;
}
public
void
setDistrict
(
String
district
)
{
this
.
district
=
district
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
public
String
getActivation_code
()
{
return
activation_code
;
}
public
void
setActivation_code
(
String
activation_code
)
{
this
.
activation_code
=
activation_code
;
}
public
String
getContacts
()
{
return
contacts
;
}
public
void
setContacts
(
String
contacts
)
{
this
.
contacts
=
contacts
;
}
public
String
getAid
()
{
return
aid
;
}
public
void
setAid
(
String
aid
)
{
this
.
aid
=
aid
;
}
public
List
<
GradeBean
>
getGradeList
()
{
return
gradeList
;
}
public
void
setGradeList
(
List
<
GradeBean
>
gradeList
)
{
this
.
gradeList
=
gradeList
;
}
}
app/src/main/java/com/oo/eye/mvp/PresenterFactory.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
;
import
com.oo.eye.mvp.contract.EyeHistroyContract
;
import
com.oo.eye.mvp.contract.EyeMainContract
;
import
com.oo.eye.mvp.contract.EyeTestContract
;
import
com.oo.eye.mvp.presenter.EyeHistroyPresenter
;
import
com.oo.eye.mvp.presenter.EyeMainPresenter
;
import
com.oo.eye.mvp.presenter.EyeTestPresenter
;
/**
* Created by xucon on 2017/12/26.
*/
public
class
PresenterFactory
{
public
static
void
createEyeTestPresenter
(
EyeTestContract
.
View
view
){
new
EyeTestPresenter
(
view
);
}
public
static
void
createEyeHistroyPresenter
(
EyeHistroyContract
.
View
view
){
new
EyeHistroyPresenter
(
view
);
}
public
static
EyeMainContract
.
Presenter
createEyeMainPresenter
(
EyeMainContract
.
View
view
){
return
new
EyeMainPresenter
(
view
);
}
}
app/src/main/java/com/oo/eye/mvp/contract/EyeHistroyContract.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
.
contract
;
import
android.content.Context
;
import
com.app.baselibrary.base.mvp.BasePresenter
;
import
com.app.baselibrary.base.mvp.BaseView
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.ArrayList
;
/**
* Created by xucon on 2017/12/26.
*/
public
interface
EyeHistroyContract
{
interface
View
extends
BaseView
<
Presenter
>
{
public
void
getEyeHistroyNetSuccee
(
ArrayList
<
StudentBean
>
beans
);
public
void
getEyeHistroyFail
(
String
msg
);
}
interface
Presenter
extends
BasePresenter
{
public
void
getEyeHistroy
(
Context
context
);
}
}
app/src/main/java/com/oo/eye/mvp/contract/EyeMainContract.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
.
contract
;
import
android.content.Context
;
import
com.app.baselibrary.base.mvp.BasePresenter
;
import
com.app.baselibrary.base.mvp.BaseView
;
/**
* Created by xucon on 2017/12/27.
*/
public
interface
EyeMainContract
{
interface
View
extends
BaseView
<
Presenter
>
{
public
void
getEyeSuccee
();
public
void
getEyeFail
(
String
msg
);
}
interface
Presenter
extends
BasePresenter
{
public
void
getEye
(
Context
context
);
}
}
app/src/main/java/com/oo/eye/mvp/contract/EyeTestContract.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
.
contract
;
import
android.content.Context
;
import
com.app.baselibrary.base.mvp.BasePresenter
;
import
com.app.baselibrary.base.mvp.BaseView
;
/**
* Created by xucon on 2017/12/26.
*/
public
interface
EyeTestContract
{
interface
View
extends
BaseView
<
Presenter
>
{
public
void
postEyeTestDataSuccee
();
public
void
postEyeTestDataFail
(
String
msg
);
}
interface
Presenter
extends
BasePresenter
{
public
void
postEyeTestData
(
Context
context
,
String
sn
,
double
leftEye
,
double
rightEye
,
int
leftLine
,
int
rightLine
);
}
}
app/src/main/java/com/oo/eye/mvp/presenter/EyeHistroyPresenter.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
.
presenter
;
import
android.content.Context
;
import
com.oo.eye.mvp.contract.EyeHistroyContract
;
/**
* Created by xucon on 2017/12/26.
*/
public
class
EyeHistroyPresenter
implements
EyeHistroyContract
.
Presenter
{
private
EyeHistroyContract
.
View
mView
;
public
EyeHistroyPresenter
(
EyeHistroyContract
.
View
view
){
this
.
mView
=
view
;
}
public
void
getEyeHistroy
(
Context
context
){
}
private
void
getEyeHistroyNet
(
int
page
,
int
limit
){
// EyeDataManager.getInstance().getEyeTestData(SnUtils.getSN(),page,limit)
// .subscribe(new RxCallback<NewResponseImpl<ArrayList<EyeHistroyBean>>>() {
// @Override
// public void onSuccess(NewResponseImpl<ArrayList<EyeHistroyBean>> response) {
// if(mView != null && mView.isActive()){
// if(response.isSuccess()){
// mView.getEyeHistroyNetSuccee(response.getData(),response.getPage());
// }else{
// mView.getEyeHistroyFail("数据获取失败");
// }
// }
// }
//
// @Override
// public void onError(int errorCode, String errorMessage) {
// if(mView != null && mView.isActive()){
// mView.getEyeHistroyFail("数据获取失败");
// }
// }
// });
}
}
app/src/main/java/com/oo/eye/mvp/presenter/EyeMainPresenter.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
.
presenter
;
import
android.content.Context
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.mvp.contract.EyeMainContract
;
/**
* Created by xucon on 2017/12/27.
*/
public
class
EyeMainPresenter
implements
EyeMainContract
.
Presenter
{
private
EyeMainContract
.
View
mView
;
public
EyeMainPresenter
(
EyeMainContract
.
View
view
){
this
.
mView
=
view
;
}
public
void
getEye
(
Context
context
){
if
(
EyeConfig
.
getInstance
().
isNetData
()){
// getEyeNet();
}
else
{
getEyeDB
(
context
);
}
}
private
void
getEyeNet
(){
// EyeDataManager.getInstance().getEyeInit(SnUtils.getSN())
// .subscribe(new RxCallback<NewResponseImpl<InitDataBean>>() {
// @Override
// public void onSuccess(NewResponseImpl<InitDataBean> response) {
// InitDataBean initDataBean = response.getResultData();
// if(initDataBean != null){
// if(initDataBean.getInitializedEye() != null){
// EyeHistroyBean initBean = initDataBean.getInitializedEye();
// if(initBean != null && initBean.getLeft_eye() != 0 && initBean.getRight_eye() != 0){
// EyeConfig.getInstance().setInitBean(initBean);
// }
// }
// if(initDataBean.getCurrentEye() != null){
// EyeHistroyBean currentBean = initDataBean.getCurrentEye();
// if(currentBean != null && currentBean.getLeft_eye() != 0 && currentBean.getRight_eye() != 0){
// EyeConfig.getInstance().setInitBean(currentBean);
// }
// }
// }
// if (mView != null && mView.isActive())
// mView.getEyeSuccee();
// }
//
// @Override
// public void onError(int errorCode, String errorMessage) {
// mView.getEyeFail(errorMessage);
// }
// });
}
private
void
getEyeDB
(
Context
context
){
try
{
// QueryBuilder<EyeHistroyBean> builder = DbManager.getDaoMaster(context).newSession().getEyeHistroyBeanDao().queryBuilder();
// List<EyeHistroyBean> descBeans = builder.orderDesc(EyeHistroyBeanDao.Properties.Created_time).build().list();
// if (descBeans != null && descBeans.size() > 0) {
// EyeConfig.getInstance().setCuurentBean(descBeans.get(0));
// EyeConfig.getInstance().setInitBean(descBeans.get(descBeans.size() - 1));
// }
// EyeConfig.getInstance().setNetData(false);
// if (mView != null && mView.isActive()) {
// mView.getEyeSuccee();
// }
}
catch
(
Exception
e
){
e
.
printStackTrace
();
if
(
mView
!=
null
&&
mView
.
isActive
())
mView
.
getEyeFail
(
"数据库加载失败"
);
}
}
}
app/src/main/java/com/oo/eye/mvp/presenter/EyeTestPresenter.java
deleted
100644 → 0
View file @
4b2dde41
package
com
.
oo
.
eye
.
mvp
.
presenter
;
import
android.content.Context
;
import
com.oo.eye.mvp.contract.EyeTestContract
;
/**
* Created by xucon on 2017/12/26.
*/
public
class
EyeTestPresenter
implements
EyeTestContract
.
Presenter
{
private
EyeTestContract
.
View
mView
;
public
EyeTestPresenter
(
EyeTestContract
.
View
view
)
{
this
.
mView
=
view
;
}
public
void
postEyeTestData
(
Context
context
,
String
sn
,
double
leftEye
,
double
rightEye
,
int
leftLine
,
int
rightLine
)
{
// if (EyeConfig.getInstance().isNetData()) {
// EyeDataManager.getInstance()
// .postEyeTestData(sn, String.valueOf(leftEye), String.valueOf(rightEye), String.valueOf(leftLine), String.valueOf(rightLine))
// .subscribe(new RxCallback<NewResponseImpl<String>>() {
// @Override
// public void onSuccess(NewResponseImpl<String> stringEyeResponse) {
// if (mView != null && mView.isActive())
// mView.postEyeTestDataSuccee();
// }
//
// @Override
// public void onError(int errorCode, String errorMessage) {
// if (mView != null && mView.isActive())
// mView.postEyeTestDataFail(errorMessage);
// }
// });
// } else {
// Date date = new Date();
// EyeHistroyBean histroyBean = new EyeHistroyBean();
// histroyBean.setLeft_eye(leftEye);
// histroyBean.setRight_eye(rightEye);
// histroyBean.setLeft_line(leftLine);
// histroyBean.setRight_line(rightLine);
// histroyBean.setCreated_time(date.getTime());
// histroyBean.setType(2);
// DbManager.getDaoMaster(context).newSession().insert(histroyBean);
// EyeChartsBean chartsBean = new EyeChartsBean();
// chartsBean.setLeft_eye(leftEye);
// chartsBean.setRight_eye(rightEye);
// chartsBean.setType(2);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
// chartsBean.setCreated_month(simpleDateFormat.format(date));
// DbManager.getDaoMaster(context).newSession().insertOrReplace(chartsBean);
// if (mView != null) {
// mView.postEyeTestDataSuccee();
// }
// }
}
}
app/src/main/java/com/oo/eye/net/EyeApiService.java
View file @
bfff9647
package
com
.
oo
.
eye
.
net
;
package
com
.
oo
.
eye
.
net
;
import
com.oo.eye.bean.SchoolBean
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.seex.netlibrary.net.response.OldResponseImpl
;
import
com.oo.seex.netlibrary.net.response.OldResponseImpl
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -24,14 +24,14 @@ public interface EyeApiService {
...
@@ -24,14 +24,14 @@ public interface EyeApiService {
@FormUrlEncoded
@FormUrlEncoded
@POST
(
NetConfig
.
ADD_EYE
)
@POST
(
NetConfig
.
ADD_EYE
)
Observable
<
OldResponseImpl
<
String
>>
postEyeTestData
(
@FieldMap
Map
<
String
,
String
>
params
);
Observable
<
OldResponseImpl
<
String
>>
postEyeTestData
(
@FieldMap
Map
<
String
,
String
>
params
);
//
/**
/**
// * 获取视力测试历史结果
* 获取学校信息
//
*/
*/
// @POST(NetConfig.GET_STUDENT_TEST_HISTORY
)
@POST
(
NetConfig
.
GET_SCHOOL
)
// Observable<OldResponseImpl<ArrayList<EyeHistroyBean>>> getEyeTestData
(@FieldMap Map<String ,String> params);
Observable
<
OldResponseImpl
<
SchoolBean
>>
getSchoolInfo
(
@FieldMap
Map
<
String
,
String
>
params
);
/**
/**
* 获取学生信息
* 获取学生信息
*/
*/
@POST
(
NetConfig
.
CLASS_STUDENT
)
@POST
(
NetConfig
.
GET_SCHOOL
)
Observable
<
OldResponseImpl
<
List
<
StudentBean
>>>
get
EyeInit
(
@FieldMap
Map
<
String
,
String
>
params
);
Observable
<
OldResponseImpl
<
List
<
StudentBean
>>>
get
Students
(
@FieldMap
Map
<
String
,
String
>
params
);
}
}
app/src/main/java/com/oo/eye/net/EyeDataManager.java
View file @
bfff9647
...
@@ -3,13 +3,20 @@ package com.oo.eye.net;
...
@@ -3,13 +3,20 @@ package com.oo.eye.net;
import
android.content.Context
;
import
android.content.Context
;
import
com.app.baselibrary.base.app.BaseApplication
;
import
com.app.baselibrary.base.app.BaseApplication
;
import
com.oo.eye.bean.SchoolBean
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.seex.netlibrary.net.response.OldResponseImpl
;
import
java.util.List
;
import
java.util.Map
;
import
rx.Observable
;
/**
/**
* Desc:app管理类;(网络本地管理)
* Desc:app管理类;(网络本地管理)
* Author: pl
* Author: pl
* Date: 2017-03-16 19:45
* Date: 2017-03-16 19:45
*/
*/
public
class
EyeDataManager
{
public
class
EyeDataManager
{
private
static
final
String
TAG
=
"EyeDataManager"
;
private
static
final
String
TAG
=
"EyeDataManager"
;
private
static
EyeDataManager
sAppDateManager
;
private
static
EyeDataManager
sAppDateManager
;
...
@@ -27,4 +34,25 @@ public class EyeDataManager {
...
@@ -27,4 +34,25 @@ public class EyeDataManager {
mContext
=
BaseApplication
.
getAppContext
();
mContext
=
BaseApplication
.
getAppContext
();
}
}
/**
* 上传视力测试结果
*/
public
Observable
<
OldResponseImpl
<
String
>>
postEyeTestData
(
Map
<
String
,
String
>
params
){
return
EyeNetManager
.
getInstance
().
getApiService
(
EyeApiService
.
class
).
postEyeTestData
(
params
);
}
/**
* 获取学校信息
*/
public
Observable
<
OldResponseImpl
<
SchoolBean
>>
getSchoolInfo
(
Map
<
String
,
String
>
params
){
return
EyeNetManager
.
getInstance
().
getApiService
(
EyeApiService
.
class
).
getSchoolInfo
(
params
);
}
/**
* 获取学生信息
*/
public
Observable
<
OldResponseImpl
<
List
<
StudentBean
>>>
getStudents
(
Map
<
String
,
String
>
params
){
return
EyeNetManager
.
getInstance
().
getApiService
(
EyeApiService
.
class
).
getStudents
(
params
);
}
}
}
app/src/main/java/com/oo/eye/net/NetConfig.java
View file @
bfff9647
...
@@ -9,16 +9,16 @@ public class NetConfig {
...
@@ -9,16 +9,16 @@ public class NetConfig {
public
static
final
String
REALY_HOST
=
"https://seex.dev.iouou.cn"
;
public
static
final
String
REALY_HOST
=
"https://seex.dev.iouou.cn"
;
public
static
final
String
DEBUG_HOST
=
"https://seex.roll.iouou.cn"
;
public
static
final
String
DEBUG_HOST
=
"https://seex.roll.iouou.cn"
;
/**
/**
* 获取
班级
学生
* 获取学生
*/
*/
public
static
final
String
CLASS_STUDENT
=
"/Api/Vision/getStudentInfo"
;
public
static
final
String
CLASS_STUDENT
=
"/A
idedTestingA
pi/Vision/getStudentInfo"
;
/**
/**
* 上传视力测量信息
* 上传视力测量信息
*/
*/
public
static
final
String
ADD_EYE
=
"/Api/Vision/add"
;
public
static
final
String
ADD_EYE
=
"/A
idedTestingA
pi/Vision/add"
;
/**
/**
* 获取
所以学生视力记录
* 获取
学校信息
*/
*/
public
static
final
String
GET_S
TUDENT_TEST_HISTORY
=
"/Api/Vision/getVisionHistory
"
;
public
static
final
String
GET_S
CHOOL
=
"/AidedTestingApi/Vision/getSchoolInfo
"
;
}
}
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