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
29fded3a
Commit
29fded3a
authored
Aug 31, 2018
by
徐丛奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aaaaaaaaaaa
parent
800d36f6
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
137 additions
and
1295 deletions
+137
-1295
misc.xml
.idea/misc.xml
+4
-1
modules.xml
.idea/modules.xml
+2
-1
build.gradle
app/build.gradle
+0
-1
EyeConfig.java
app/src/main/java/com/oo/eye/EyeConfig.java
+4
-4
EyeTestActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
+3
-3
EyeTestMainActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestMainActivity.java
+3
-10
SinglePeopleTestActivity.java
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
+3
-3
EyeHistroyListAdapter.java
app/src/main/java/com/oo/eye/adapter/EyeHistroyListAdapter.java
+0
-124
ClassBean.java
app/src/main/java/com/oo/eye/bean/ClassBean.java
+14
-0
EyeChartsBean.java
app/src/main/java/com/oo/eye/bean/EyeChartsBean.java
+0
-78
EyeHistroyBean.java
app/src/main/java/com/oo/eye/bean/EyeHistroyBean.java
+0
-97
EyeTestBean.java
app/src/main/java/com/oo/eye/bean/EyeTestBean.java
+0
-101
GradeBean.java
app/src/main/java/com/oo/eye/bean/GradeBean.java
+13
-0
InitDataBean.java
app/src/main/java/com/oo/eye/bean/InitDataBean.java
+0
-27
StudentBean.java
app/src/main/java/com/oo/eye/bean/StudentBean.java
+5
-5
DbManager.java
app/src/main/java/com/oo/eye/db/DbManager.java
+80
-86
DaoMaster.java
app/src/main/java/com/oo/eye/gen/DaoMaster.java
+0
-99
DaoSession.java
app/src/main/java/com/oo/eye/gen/DaoSession.java
+0
-62
EyeChartsBeanDao.java
app/src/main/java/com/oo/eye/gen/EyeChartsBeanDao.java
+0
-139
EyeHistroyBeanDao.java
app/src/main/java/com/oo/eye/gen/EyeHistroyBeanDao.java
+0
-151
PresenterFactory.java
app/src/main/java/com/oo/eye/mvp/PresenterFactory.java
+0
-6
EyeChartsContract.java
app/src/main/java/com/oo/eye/mvp/contract/EyeChartsContract.java
+0
-24
EyeHistroyContract.java
app/src/main/java/com/oo/eye/mvp/contract/EyeHistroyContract.java
+3
-6
EyeChartsPresenter.java
app/src/main/java/com/oo/eye/mvp/presenter/EyeChartsPresenter.java
+0
-74
EyeHistroyPresenter.java
app/src/main/java/com/oo/eye/mvp/presenter/EyeHistroyPresenter.java
+1
-28
EyeApiService.java
app/src/main/java/com/oo/eye/net/EyeApiService.java
+2
-2
ChartsView.java
app/src/main/java/com/oo/eye/widget/ChartsView.java
+0
-163
No files found.
.idea/misc.xml
View file @
29fded3a
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"EntryPointsManager"
>
<entry_points
version=
"2.0"
/>
</component>
<component
name=
"NullableNotNullManager"
>
<option
name=
"myDefaultNullable"
value=
"android.support.annotation.Nullable"
/>
<option
name=
"myDefaultNotNull"
value=
"android.support.annotation.NonNull"
/>
...
...
@@ -40,7 +43,7 @@
</profile-state>
</entry>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
project-jdk-name=
"1.8 (6)
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
.idea/modules.xml
View file @
29fded3a
...
...
@@ -4,7 +4,8 @@
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/app/app.iml"
filepath=
"$PROJECT_DIR$/app/app.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/library/baselibrary/baselibrary.iml"
filepath=
"$PROJECT_DIR$/library/baselibrary/baselibrary.iml"
/>
<module
fileurl=
"file://G:\workspace_ooyby\haihang\eye_haihang.iml"
filepath=
"G:\workspace_ooyby\haihang\eye_haihang.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/eye_haihang.iml"
filepath=
"$PROJECT_DIR$/eye_haihang.iml"
/>
<module
fileurl=
"file://G:/workspace_ooyby/haihang/eye_haihang.iml"
filepath=
"G:/workspace_ooyby/haihang/eye_haihang.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/haihang.iml"
filepath=
"$PROJECT_DIR$/.idea/haihang.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/library/library.iml"
filepath=
"$PROJECT_DIR$/library/library.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/library/netlibrary/netlibrary.iml"
filepath=
"$PROJECT_DIR$/library/netlibrary/netlibrary.iml"
/>
...
...
app/build.gradle
View file @
29fded3a
...
...
@@ -37,5 +37,4 @@ dependencies {
compile
project
(
':library:netlibrary'
)
compile
'com.jakewharton:butterknife:8.6.0'
apt
'com.jakewharton:butterknife-compiler:8.6.0'
compile
'com.github.PhilJay:MPAndroidChart:v3.0.2'
}
app/src/main/java/com/oo/eye/EyeConfig.java
View file @
29fded3a
package
com
.
oo
.
eye
;
import
com.oo.eye.bean.Student
;
import
com.oo.eye.bean.Student
Bean
;
import
java.util.List
;
...
...
@@ -19,7 +19,7 @@ public class EyeConfig {
private
boolean
isNetData
=
false
;
private
List
<
Student
>
mStudents
;
private
List
<
Student
Bean
>
mStudents
;
private
static
EyeConfig
instance
=
new
EyeConfig
();
...
...
@@ -39,11 +39,11 @@ public class EyeConfig {
isNetData
=
netData
;
}
public
List
<
Student
>
getStudents
()
{
public
List
<
Student
Bean
>
getStudents
()
{
return
mStudents
;
}
public
void
setStudents
(
List
<
Student
>
students
)
{
public
void
setStudents
(
List
<
Student
Bean
>
students
)
{
mStudents
=
students
;
}
}
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
View file @
29fded3a
...
...
@@ -17,7 +17,7 @@ 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.Student
;
import
com.oo.eye.bean.Student
Bean
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
...
...
@@ -66,8 +66,8 @@ public class EyeTestActivity extends BaseActivity {
private
int
mLocation
;
private
int
mLevelIndex
=
-
1
;
private
LinkedHashMap
<
Integer
,
List
<
E
>>
mCollect
=
new
LinkedHashMap
<>();
private
Student
measureStudent
;
private
List
<
Student
>
mStudentList
=
new
ArrayList
<>();
private
Student
Bean
measureStudent
;
private
List
<
Student
Bean
>
mStudentList
=
new
ArrayList
<>();
//是否是右眼训练
private
boolean
isSecondTest
;
private
int
currentIndex
;
...
...
app/src/main/java/com/oo/eye/activity/EyeTestMainActivity.java
View file @
29fded3a
...
...
@@ -12,10 +12,7 @@ import com.app.baselibrary.commonUtil.LogUtil;
import
com.app.baselibrary.commonUtil.ToastUtil
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.EyeChartsBean
;
import
com.oo.eye.bean.EyeHistroyBean
;
import
com.oo.eye.bean.Student
;
import
com.oo.eye.db.DbManager
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.mvp.PresenterFactory
;
import
com.oo.eye.mvp.contract.EyeMainContract
;
...
...
@@ -55,10 +52,6 @@ public class EyeTestMainActivity extends BaseActivity implements EyeMainContract
@Override
protected
void
init
()
{
mPresenter
=
PresenterFactory
.
createEyeMainPresenter
(
this
);
if
(
EyeConfig
.
getInstance
().
isNetData
())
{
DbManager
.
getDaoMaster
(
this
).
newSession
().
deleteAll
(
EyeHistroyBean
.
class
);
DbManager
.
getDaoMaster
(
this
).
newSession
().
deleteAll
(
EyeChartsBean
.
class
);
}
mPresenter
.
getEye
(
this
);
}
...
...
@@ -117,8 +110,8 @@ public class EyeTestMainActivity extends BaseActivity implements EyeMainContract
startActivity
(
MorePeopleTestActivity
.
class
);
break
;
case
R
.
id
.
lin_eye_test_statistics
:
ArrayList
<
Student
>
list
=
new
ArrayList
<>();
Student
student
=
new
Student
();
ArrayList
<
Student
Bean
>
list
=
new
ArrayList
<>();
Student
Bean
student
=
new
StudentBean
();
student
.
setRealname
(
"游客"
);
list
.
add
(
student
);
EyeConfig
.
getInstance
().
setStudents
(
list
);
...
...
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
View file @
29fded3a
...
...
@@ -6,7 +6,7 @@ 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.bean.Student
;
import
com.oo.eye.bean.Student
Bean
;
import
java.util.ArrayList
;
...
...
@@ -41,8 +41,8 @@ public class SinglePeopleTestActivity extends BaseActivity {
@OnClick
(
R
.
id
.
begin_test
)
public
void
onClick
()
{
ArrayList
<
Student
>
list
=
new
ArrayList
<>();
Student
student
=
new
Student
();
ArrayList
<
Student
Bean
>
list
=
new
ArrayList
<>();
Student
Bean
student
=
new
StudentBean
();
student
.
setRealname
(
"游客"
);
list
.
add
(
student
);
EyeConfig
.
getInstance
().
setStudents
(
list
);
...
...
app/src/main/java/com/oo/eye/adapter/EyeHistroyListAdapter.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
adapter
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.TextView
;
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.EyeHistroyBean
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created by gyp on 17/5/19.
*/
public
class
EyeHistroyListAdapter
extends
BaseAdapter
{
private
AdapterLoadMoreListener
mAdapterLoadMoreListener
;
private
SimpleDateFormat
mDateFormat
=
new
SimpleDateFormat
(
"yyyy.MM.dd HH:mm"
);
private
Context
context
;
private
List
<
EyeHistroyBean
>
list
=
new
ArrayList
<>();
private
int
selectId
;
public
void
updateList
(
List
<
EyeHistroyBean
>
list
)
{
this
.
list
.
clear
();
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
this
.
list
.
addAll
(
list
);
notifyDataSetChanged
();
}
}
public
void
setAdapterLoadMoreListener
(
AdapterLoadMoreListener
adapterLoadMoreListener
)
{
mAdapterLoadMoreListener
=
adapterLoadMoreListener
;
}
public
EyeHistroyListAdapter
(
Context
context
,
List
<
EyeHistroyBean
>
list
)
{
this
.
context
=
context
;
selectId
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
0
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
this
.
list
.
addAll
(
list
);
}
@Override
public
int
getCount
()
{
return
list
==
null
?
0
:
list
.
size
();
}
@Override
public
Object
getItem
(
int
i
)
{
return
list
.
get
(
i
);
}
@Override
public
long
getItemId
(
int
i
)
{
return
i
;
}
@Override
public
View
getView
(
int
i
,
View
view
,
ViewGroup
viewGroup
)
{
ViewHolder
holder
;
if
(
view
==
null
)
{
holder
=
new
ViewHolder
();
LayoutInflater
inflater
=
LayoutInflater
.
from
(
context
);
view
=
inflater
.
inflate
(
R
.
layout
.
item_histroy
,
null
);
holder
.
timeText
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
tv_item_histroy_time
);
holder
.
leftVisionText
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
tv_item_histroy_left
);
holder
.
rightVisionText
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
tv_item_histroy_right
);
holder
.
soureText
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
tv_item_histroy_source
);
view
.
setTag
(
holder
);
}
else
{
holder
=
(
ViewHolder
)
view
.
getTag
();
}
view
.
setFocusable
(
true
);
view
.
setFocusableInTouchMode
(
true
);
EyeHistroyBean
model
=
list
.
get
(
i
);
holder
.
timeText
.
setText
(
mDateFormat
.
format
(
new
Date
(
model
.
getCreated_time
())));
if
(
selectId
==
1
){
holder
.
leftVisionText
.
setText
(
String
.
valueOf
(
Eye
.
transformSmall
(
model
.
getLeft_eye
())));
holder
.
rightVisionText
.
setText
(
String
.
valueOf
(
Eye
.
transformSmall
(
model
.
getRight_eye
())));
}
else
{
holder
.
leftVisionText
.
setText
(
String
.
valueOf
(
model
.
getLeft_eye
()));
holder
.
rightVisionText
.
setText
(
String
.
valueOf
(
model
.
getRight_eye
()));
}
holder
.
soureText
.
setText
(
model
.
getType
()==
1
?
"用户录入"
:
"自动计算"
);
if
(
i
>
0
&&
i
==
list
.
size
()
-
1
)
{
view
.
setOnFocusChangeListener
(
new
View
.
OnFocusChangeListener
()
{
@Override
public
void
onFocusChange
(
View
v
,
boolean
hasFocus
)
{
if
(
hasFocus
)
{
if
(
mAdapterLoadMoreListener
!=
null
)
mAdapterLoadMoreListener
.
adapterLoadMore
();
}
}
});
}
return
view
;
}
private
class
ViewHolder
{
public
TextView
timeText
;
public
TextView
leftVisionText
;
public
TextView
rightVisionText
;
public
TextView
soureText
;
}
public
interface
AdapterLoadMoreListener
{
void
adapterLoadMore
();
}
}
app/src/main/java/com/oo/eye/bean/ClassBean.java
0 → 100644
View file @
29fded3a
package
com
.
oo
.
eye
.
bean
;
import
com.app.baselibrary.bean.BaseBean
;
/**
* Created by xucon on 2018/8/31.
*/
public
class
ClassBean
extends
BaseBean
{
private
String
sid
;
private
String
id
;
private
String
gradeId
;
private
String
name
;
}
app/src/main/java/com/oo/eye/bean/EyeChartsBean.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
bean
;
import
org.greenrobot.greendao.annotation.Entity
;
import
org.greenrobot.greendao.annotation.Generated
;
import
org.greenrobot.greendao.annotation.Id
;
import
org.greenrobot.greendao.annotation.NotNull
;
import
org.greenrobot.greendao.annotation.Unique
;
/**
* Created by xucon on 2017/12/26.
*/
@Entity
public
class
EyeChartsBean
{
@Id
(
autoincrement
=
true
)
private
Long
charts_id
;
private
double
left_eye
;
private
double
right_eye
;
private
int
type
;
@NotNull
@Unique
private
String
created_month
;
@Generated
(
hash
=
482229128
)
public
EyeChartsBean
(
Long
charts_id
,
double
left_eye
,
double
right_eye
,
int
type
,
@NotNull
String
created_month
)
{
this
.
charts_id
=
charts_id
;
this
.
left_eye
=
left_eye
;
this
.
right_eye
=
right_eye
;
this
.
type
=
type
;
this
.
created_month
=
created_month
;
}
@Generated
(
hash
=
1551796263
)
public
EyeChartsBean
()
{
}
public
Long
getCharts_id
()
{
return
charts_id
;
}
public
void
setCharts_id
(
Long
charts_id
)
{
this
.
charts_id
=
charts_id
;
}
public
double
getLeft_eye
()
{
return
left_eye
;
}
public
void
setLeft_eye
(
double
left_eye
)
{
this
.
left_eye
=
left_eye
;
}
public
double
getRight_eye
()
{
return
right_eye
;
}
public
void
setRight_eye
(
double
right_eye
)
{
this
.
right_eye
=
right_eye
;
}
public
int
getType
()
{
return
type
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
public
String
getCreated_month
()
{
return
created_month
;
}
public
void
setCreated_month
(
String
created_month
)
{
this
.
created_month
=
created_month
;
}
}
app/src/main/java/com/oo/eye/bean/EyeHistroyBean.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
bean
;
import
org.greenrobot.greendao.annotation.Entity
;
import
org.greenrobot.greendao.annotation.Generated
;
import
org.greenrobot.greendao.annotation.Id
;
import
org.greenrobot.greendao.annotation.NotNull
;
import
org.greenrobot.greendao.annotation.Unique
;
/**
* Created by xucon on 2017/12/21.
*/
@Entity
public
class
EyeHistroyBean
{
@Id
(
autoincrement
=
true
)
private
Long
id
;
private
double
left_eye
;
private
double
right_eye
;
private
int
left_line
;
private
int
right_line
;
@NotNull
@Unique
private
long
created_time
;
private
int
type
;
@Generated
(
hash
=
1086901756
)
public
EyeHistroyBean
(
Long
id
,
double
left_eye
,
double
right_eye
,
int
left_line
,
int
right_line
,
long
created_time
,
int
type
)
{
this
.
id
=
id
;
this
.
left_eye
=
left_eye
;
this
.
right_eye
=
right_eye
;
this
.
left_line
=
left_line
;
this
.
right_line
=
right_line
;
this
.
created_time
=
created_time
;
this
.
type
=
type
;
}
@Generated
(
hash
=
913374113
)
public
EyeHistroyBean
()
{
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
double
getLeft_eye
()
{
return
left_eye
;
}
public
void
setLeft_eye
(
double
left_eye
)
{
this
.
left_eye
=
left_eye
;
}
public
double
getRight_eye
()
{
return
right_eye
;
}
public
void
setRight_eye
(
double
right_eye
)
{
this
.
right_eye
=
right_eye
;
}
public
int
getLeft_line
()
{
return
left_line
;
}
public
void
setLeft_line
(
int
left_line
)
{
this
.
left_line
=
left_line
;
}
public
int
getRight_line
()
{
return
right_line
;
}
public
void
setRight_line
(
int
right_line
)
{
this
.
right_line
=
right_line
;
}
public
long
getCreated_time
()
{
return
created_time
;
}
public
void
setCreated_time
(
long
created_time
)
{
this
.
created_time
=
created_time
;
}
public
int
getType
()
{
return
type
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
}
app/src/main/java/com/oo/eye/bean/EyeTestBean.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
bean
;
import
com.app.baselibrary.bean.BaseBean
;
/**
* Created by xucon on 2017/12/26.
*/
public
class
EyeTestBean
extends
BaseBean
{
private
String
deviceSN
;
private
boolean
isNetData
;
private
String
name
;
private
double
firstLeftEye
;
private
double
firstRightEye
;
private
double
left
;
private
double
right
;
private
int
leftLine
;
private
int
rightLine
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDeviceSN
()
{
return
deviceSN
;
}
public
void
setDeviceSN
(
String
deviceSN
)
{
this
.
deviceSN
=
deviceSN
;
}
public
double
getFirstLeftEye
()
{
return
firstLeftEye
;
}
public
void
setFirstLeftEye
(
double
firstLeftEye
)
{
this
.
firstLeftEye
=
firstLeftEye
;
}
public
double
getFirstRightEye
()
{
return
firstRightEye
;
}
public
void
setFirstRightEye
(
double
firstRightEye
)
{
this
.
firstRightEye
=
firstRightEye
;
}
public
double
getLeft
()
{
return
left
;
}
public
void
setLeft
(
double
left
)
{
this
.
left
=
left
;
}
public
double
getRight
()
{
return
right
;
}
public
void
setRight
(
double
right
)
{
this
.
right
=
right
;
}
public
int
getLeftLine
()
{
return
leftLine
;
}
public
void
setLeftLine
(
int
leftLine
)
{
this
.
leftLine
=
leftLine
;
}
public
int
getRightLine
()
{
return
rightLine
;
}
public
void
setRightLine
(
int
rightLine
)
{
this
.
rightLine
=
rightLine
;
}
public
boolean
isNetData
()
{
return
isNetData
;
}
public
void
setNetData
(
boolean
netData
)
{
isNetData
=
netData
;
}
}
app/src/main/java/com/oo/eye/bean/GradeBean.java
0 → 100644
View file @
29fded3a
package
com
.
oo
.
eye
.
bean
;
import
com.app.baselibrary.bean.BaseBean
;
/**
* Created by xucon on 2018/8/31.
*/
public
class
GradeBean
extends
BaseBean
{
private
String
sid
;
private
String
id
;
private
String
name
;
}
app/src/main/java/com/oo/eye/bean/InitDataBean.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
bean
;
/**
* Created by xucon on 2017/12/28.
*/
public
class
InitDataBean
{
private
EyeHistroyBean
initializedEye
;
private
EyeHistroyBean
currentEye
;
public
EyeHistroyBean
getInitializedEye
()
{
return
initializedEye
;
}
public
void
setInitializedEye
(
EyeHistroyBean
initializedEye
)
{
this
.
initializedEye
=
initializedEye
;
}
public
EyeHistroyBean
getCurrentEye
()
{
return
currentEye
;
}
public
void
setCurrentEye
(
EyeHistroyBean
currentEye
)
{
this
.
currentEye
=
currentEye
;
}
}
app/src/main/java/com/oo/eye/bean/Student.java
→
app/src/main/java/com/oo/eye/bean/Student
Bean
.java
View file @
29fded3a
...
...
@@ -6,7 +6,7 @@ import com.app.baselibrary.bean.BaseBean;
/**
* Created by henry 16/1/30.
*/
public
class
Student
extends
BaseBean
{
public
class
Student
Bean
extends
BaseBean
{
private
String
sid
;
private
String
uid
;
private
String
school
;
...
...
@@ -125,8 +125,8 @@ public class Student extends BaseBean {
this
.
distance
=
distance
;
}
public
Student
copy
(){
Student
student
=
new
Student
();
public
Student
Bean
copy
(){
Student
Bean
student
=
new
StudentBean
();
student
.
setSid
(
this
.
sid
);
student
.
setPid
(
this
.
pid
);
student
.
setClasses
(
this
.
classes
);
...
...
@@ -143,8 +143,8 @@ public class Student extends BaseBean {
return
student
;
}
public
Student
transition
(
int
measureDis
){
Student
student
=
new
Student
();
public
Student
Bean
transition
(
int
measureDis
){
Student
Bean
student
=
new
StudentBean
();
student
.
setSid
(
this
.
sid
);
student
.
setPid
(
this
.
pid
);
student
.
setClasses
(
this
.
classes
);
...
...
app/src/main/java/com/oo/eye/db/DbManager.java
View file @
29fded3a
package
com
.
oo
.
eye
.
db
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
com.oo.eye.gen.DaoMaster
;
import
com.oo.eye.gen.DaoSession
;
/**
*/
public
class
DbManager
{
private
static
DbManager
mDbManager
;
private
static
final
String
DB_NAME
=
"eye_test.db"
;
private
static
DaoMaster
.
DevOpenHelper
mDevOpenHelper
;
private
static
DaoMaster
mDaoMaster
;
private
static
DaoSession
mDaoSession
;
public
static
DbManager
getInstance
(
Context
context
)
{
if
(
null
==
mDbManager
)
{
synchronized
(
DbManager
.
class
)
{
if
(
null
==
mDbManager
)
mDbManager
=
new
DbManager
(
context
);
}
}
return
mDbManager
;
}
private
DbManager
(
Context
context
)
{
mDevOpenHelper
=
new
DaoMaster
.
DevOpenHelper
(
context
,
DB_NAME
);
getDaoMaster
(
context
);
getDaoSession
(
context
);
}
/**
* @desc 获取可读数据库
* @autor Tiany
* @time 2016/8/13
**/
public
static
SQLiteDatabase
getReadableDatabase
(
Context
context
)
{
if
(
null
==
mDevOpenHelper
)
{
getInstance
(
context
);
}
return
mDevOpenHelper
.
getReadableDatabase
();
}
/**
* @desc 获取可写数据库
* @autor Tiany
* @time 2016/8/13
**/
public
static
SQLiteDatabase
getWritableDatabase
(
Context
context
)
{
if
(
null
==
mDevOpenHelper
)
{
getInstance
(
context
);
}
return
mDevOpenHelper
.
getWritableDatabase
();
}
/**
* 获取DaoSession;
* @param context
* @return
*/
public
static
DaoSession
getDaoSession
(
Context
context
)
{
if
(
null
==
mDaoSession
)
{
synchronized
(
DbManager
.
class
)
{
if
(
null
==
mDaoSession
)
mDaoSession
=
getDaoMaster
(
context
).
newSession
();
}
}
return
mDaoSession
;
}
/**
* 获取DaoMaster;
* @param context
* @return
*/
public
static
DaoMaster
getDaoMaster
(
Context
context
)
{
if
(
null
==
mDaoMaster
)
{
synchronized
(
DbManager
.
class
)
{
if
(
null
==
mDaoMaster
)
mDaoMaster
=
new
DaoMaster
(
getWritableDatabase
(
context
));
}
}
return
mDaoMaster
;
}
//
private static DbManager mDbManager;
//
//
private static final String DB_NAME = "eye_test.db";
//
private static DaoMaster.DevOpenHelper mDevOpenHelper;
//
private static DaoMaster mDaoMaster;
//
private static DaoSession mDaoSession;
//
//
public static DbManager getInstance(Context context) {
//
if (null == mDbManager) {
//
synchronized (DbManager.class) {
//
if (null == mDbManager)
//
mDbManager = new DbManager(context);
//
}
//
}
//
//
return mDbManager;
//
}
//
//
private DbManager(Context context) {
//
mDevOpenHelper = new DaoMaster.DevOpenHelper(context,DB_NAME);
//
getDaoMaster(context);
//
getDaoSession(context);
//
}
//
//
/**
//
* @desc 获取可读数据库
//
* @autor Tiany
//
* @time 2016/8/13
//
**/
//
public static SQLiteDatabase getReadableDatabase(Context context) {
//
if (null == mDevOpenHelper) {
//
getInstance(context);
//
}
//
return mDevOpenHelper.getReadableDatabase();
//
}
//
//
/**
//
* @desc 获取可写数据库
//
* @autor Tiany
//
* @time 2016/8/13
//
**/
//
public static SQLiteDatabase getWritableDatabase(Context context) {
//
if (null == mDevOpenHelper) {
//
getInstance(context);
//
}
//
return mDevOpenHelper.getWritableDatabase();
//
}
//
//
//
/**
//
* 获取DaoSession;
//
* @param context
//
* @return
//
*/
//
public static DaoSession getDaoSession(Context context) {
//
//
if (null == mDaoSession) {
//
synchronized (DbManager.class) {
//
if (null == mDaoSession)
//
mDaoSession = getDaoMaster(context).newSession();
//
}
//
}
//
return mDaoSession;
//
}
//
//
/**
//
* 获取DaoMaster;
//
* @param context
//
* @return
//
*/
//
public static DaoMaster getDaoMaster(Context context) {
//
//
if (null == mDaoMaster) {
//
synchronized (DbManager.class) {
//
if (null == mDaoMaster)
//
mDaoMaster = new DaoMaster(getWritableDatabase(context));
//
}
//
}
//
return mDaoMaster;
//
}
}
app/src/main/java/com/oo/eye/gen/DaoMaster.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
gen
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteDatabase.CursorFactory
;
import
android.util.Log
;
import
org.greenrobot.greendao.AbstractDaoMaster
;
import
org.greenrobot.greendao.database.StandardDatabase
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.database.DatabaseOpenHelper
;
import
org.greenrobot.greendao.identityscope.IdentityScopeType
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 1): knows all DAOs.
*/
public
class
DaoMaster
extends
AbstractDaoMaster
{
public
static
final
int
SCHEMA_VERSION
=
1
;
/** Creates underlying database table using DAOs. */
public
static
void
createAllTables
(
Database
db
,
boolean
ifNotExists
)
{
EyeChartsBeanDao
.
createTable
(
db
,
ifNotExists
);
EyeHistroyBeanDao
.
createTable
(
db
,
ifNotExists
);
}
/** Drops underlying database table using DAOs. */
public
static
void
dropAllTables
(
Database
db
,
boolean
ifExists
)
{
EyeChartsBeanDao
.
dropTable
(
db
,
ifExists
);
EyeHistroyBeanDao
.
dropTable
(
db
,
ifExists
);
}
/**
* WARNING: Drops all table on Upgrade! Use only during development.
* Convenience method using a {@link DevOpenHelper}.
*/
public
static
DaoSession
newDevSession
(
Context
context
,
String
name
)
{
Database
db
=
new
DevOpenHelper
(
context
,
name
).
getWritableDb
();
DaoMaster
daoMaster
=
new
DaoMaster
(
db
);
return
daoMaster
.
newSession
();
}
public
DaoMaster
(
SQLiteDatabase
db
)
{
this
(
new
StandardDatabase
(
db
));
}
public
DaoMaster
(
Database
db
)
{
super
(
db
,
SCHEMA_VERSION
);
registerDaoClass
(
EyeChartsBeanDao
.
class
);
registerDaoClass
(
EyeHistroyBeanDao
.
class
);
}
public
DaoSession
newSession
()
{
return
new
DaoSession
(
db
,
IdentityScopeType
.
Session
,
daoConfigMap
);
}
public
DaoSession
newSession
(
IdentityScopeType
type
)
{
return
new
DaoSession
(
db
,
type
,
daoConfigMap
);
}
/**
* Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
*/
public
static
abstract
class
OpenHelper
extends
DatabaseOpenHelper
{
public
OpenHelper
(
Context
context
,
String
name
)
{
super
(
context
,
name
,
SCHEMA_VERSION
);
}
public
OpenHelper
(
Context
context
,
String
name
,
CursorFactory
factory
)
{
super
(
context
,
name
,
factory
,
SCHEMA_VERSION
);
}
@Override
public
void
onCreate
(
Database
db
)
{
Log
.
i
(
"greenDAO"
,
"Creating tables for schema version "
+
SCHEMA_VERSION
);
createAllTables
(
db
,
false
);
}
}
/** WARNING: Drops all table on Upgrade! Use only during development. */
public
static
class
DevOpenHelper
extends
OpenHelper
{
public
DevOpenHelper
(
Context
context
,
String
name
)
{
super
(
context
,
name
);
}
public
DevOpenHelper
(
Context
context
,
String
name
,
CursorFactory
factory
)
{
super
(
context
,
name
,
factory
);
}
@Override
public
void
onUpgrade
(
Database
db
,
int
oldVersion
,
int
newVersion
)
{
Log
.
i
(
"greenDAO"
,
"Upgrading schema from version "
+
oldVersion
+
" to "
+
newVersion
+
" by dropping all tables"
);
dropAllTables
(
db
,
true
);
onCreate
(
db
);
}
}
}
app/src/main/java/com/oo/eye/gen/DaoSession.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
gen
;
import
java.util.Map
;
import
org.greenrobot.greendao.AbstractDao
;
import
org.greenrobot.greendao.AbstractDaoSession
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.identityscope.IdentityScopeType
;
import
org.greenrobot.greendao.internal.DaoConfig
;
import
com.oo.eye.bean.EyeChartsBean
;
import
com.oo.eye.bean.EyeHistroyBean
;
import
com.oo.eye.gen.EyeChartsBeanDao
;
import
com.oo.eye.gen.EyeHistroyBeanDao
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* {@inheritDoc}
*
* @see org.greenrobot.greendao.AbstractDaoSession
*/
public
class
DaoSession
extends
AbstractDaoSession
{
private
final
DaoConfig
eyeChartsBeanDaoConfig
;
private
final
DaoConfig
eyeHistroyBeanDaoConfig
;
private
final
EyeChartsBeanDao
eyeChartsBeanDao
;
private
final
EyeHistroyBeanDao
eyeHistroyBeanDao
;
public
DaoSession
(
Database
db
,
IdentityScopeType
type
,
Map
<
Class
<?
extends
AbstractDao
<?,
?>>,
DaoConfig
>
daoConfigMap
)
{
super
(
db
);
eyeChartsBeanDaoConfig
=
daoConfigMap
.
get
(
EyeChartsBeanDao
.
class
).
clone
();
eyeChartsBeanDaoConfig
.
initIdentityScope
(
type
);
eyeHistroyBeanDaoConfig
=
daoConfigMap
.
get
(
EyeHistroyBeanDao
.
class
).
clone
();
eyeHistroyBeanDaoConfig
.
initIdentityScope
(
type
);
eyeChartsBeanDao
=
new
EyeChartsBeanDao
(
eyeChartsBeanDaoConfig
,
this
);
eyeHistroyBeanDao
=
new
EyeHistroyBeanDao
(
eyeHistroyBeanDaoConfig
,
this
);
registerDao
(
EyeChartsBean
.
class
,
eyeChartsBeanDao
);
registerDao
(
EyeHistroyBean
.
class
,
eyeHistroyBeanDao
);
}
public
void
clear
()
{
eyeChartsBeanDaoConfig
.
clearIdentityScope
();
eyeHistroyBeanDaoConfig
.
clearIdentityScope
();
}
public
EyeChartsBeanDao
getEyeChartsBeanDao
()
{
return
eyeChartsBeanDao
;
}
public
EyeHistroyBeanDao
getEyeHistroyBeanDao
()
{
return
eyeHistroyBeanDao
;
}
}
app/src/main/java/com/oo/eye/gen/EyeChartsBeanDao.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
gen
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteStatement
;
import
org.greenrobot.greendao.AbstractDao
;
import
org.greenrobot.greendao.Property
;
import
org.greenrobot.greendao.internal.DaoConfig
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.database.DatabaseStatement
;
import
com.oo.eye.bean.EyeChartsBean
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "EYE_CHARTS_BEAN".
*/
public
class
EyeChartsBeanDao
extends
AbstractDao
<
EyeChartsBean
,
Long
>
{
public
static
final
String
TABLENAME
=
"EYE_CHARTS_BEAN"
;
/**
* Properties of entity EyeChartsBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public
static
class
Properties
{
public
final
static
Property
Charts_id
=
new
Property
(
0
,
Long
.
class
,
"charts_id"
,
true
,
"_id"
);
public
final
static
Property
Left_eye
=
new
Property
(
1
,
double
.
class
,
"left_eye"
,
false
,
"LEFT_EYE"
);
public
final
static
Property
Right_eye
=
new
Property
(
2
,
double
.
class
,
"right_eye"
,
false
,
"RIGHT_EYE"
);
public
final
static
Property
Type
=
new
Property
(
3
,
int
.
class
,
"type"
,
false
,
"TYPE"
);
public
final
static
Property
Created_month
=
new
Property
(
4
,
String
.
class
,
"created_month"
,
false
,
"CREATED_MONTH"
);
}
public
EyeChartsBeanDao
(
DaoConfig
config
)
{
super
(
config
);
}
public
EyeChartsBeanDao
(
DaoConfig
config
,
DaoSession
daoSession
)
{
super
(
config
,
daoSession
);
}
/** Creates the underlying database table. */
public
static
void
createTable
(
Database
db
,
boolean
ifNotExists
)
{
String
constraint
=
ifNotExists
?
"IF NOT EXISTS "
:
""
;
db
.
execSQL
(
"CREATE TABLE "
+
constraint
+
"\"EYE_CHARTS_BEAN\" ("
+
//
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ,"
+
// 0: charts_id
"\"LEFT_EYE\" REAL NOT NULL ,"
+
// 1: left_eye
"\"RIGHT_EYE\" REAL NOT NULL ,"
+
// 2: right_eye
"\"TYPE\" INTEGER NOT NULL ,"
+
// 3: type
"\"CREATED_MONTH\" TEXT NOT NULL UNIQUE );"
);
// 4: created_month
}
/** Drops the underlying database table. */
public
static
void
dropTable
(
Database
db
,
boolean
ifExists
)
{
String
sql
=
"DROP TABLE "
+
(
ifExists
?
"IF EXISTS "
:
""
)
+
"\"EYE_CHARTS_BEAN\""
;
db
.
execSQL
(
sql
);
}
@Override
protected
final
void
bindValues
(
DatabaseStatement
stmt
,
EyeChartsBean
entity
)
{
stmt
.
clearBindings
();
Long
charts_id
=
entity
.
getCharts_id
();
if
(
charts_id
!=
null
)
{
stmt
.
bindLong
(
1
,
charts_id
);
}
stmt
.
bindDouble
(
2
,
entity
.
getLeft_eye
());
stmt
.
bindDouble
(
3
,
entity
.
getRight_eye
());
stmt
.
bindLong
(
4
,
entity
.
getType
());
stmt
.
bindString
(
5
,
entity
.
getCreated_month
());
}
@Override
protected
final
void
bindValues
(
SQLiteStatement
stmt
,
EyeChartsBean
entity
)
{
stmt
.
clearBindings
();
Long
charts_id
=
entity
.
getCharts_id
();
if
(
charts_id
!=
null
)
{
stmt
.
bindLong
(
1
,
charts_id
);
}
stmt
.
bindDouble
(
2
,
entity
.
getLeft_eye
());
stmt
.
bindDouble
(
3
,
entity
.
getRight_eye
());
stmt
.
bindLong
(
4
,
entity
.
getType
());
stmt
.
bindString
(
5
,
entity
.
getCreated_month
());
}
@Override
public
Long
readKey
(
Cursor
cursor
,
int
offset
)
{
return
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getLong
(
offset
+
0
);
}
@Override
public
EyeChartsBean
readEntity
(
Cursor
cursor
,
int
offset
)
{
EyeChartsBean
entity
=
new
EyeChartsBean
(
//
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getLong
(
offset
+
0
),
// charts_id
cursor
.
getDouble
(
offset
+
1
),
// left_eye
cursor
.
getDouble
(
offset
+
2
),
// right_eye
cursor
.
getInt
(
offset
+
3
),
// type
cursor
.
getString
(
offset
+
4
)
// created_month
);
return
entity
;
}
@Override
public
void
readEntity
(
Cursor
cursor
,
EyeChartsBean
entity
,
int
offset
)
{
entity
.
setCharts_id
(
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getLong
(
offset
+
0
));
entity
.
setLeft_eye
(
cursor
.
getDouble
(
offset
+
1
));
entity
.
setRight_eye
(
cursor
.
getDouble
(
offset
+
2
));
entity
.
setType
(
cursor
.
getInt
(
offset
+
3
));
entity
.
setCreated_month
(
cursor
.
getString
(
offset
+
4
));
}
@Override
protected
final
Long
updateKeyAfterInsert
(
EyeChartsBean
entity
,
long
rowId
)
{
entity
.
setCharts_id
(
rowId
);
return
rowId
;
}
@Override
public
Long
getKey
(
EyeChartsBean
entity
)
{
if
(
entity
!=
null
)
{
return
entity
.
getCharts_id
();
}
else
{
return
null
;
}
}
@Override
public
boolean
hasKey
(
EyeChartsBean
entity
)
{
return
entity
.
getCharts_id
()
!=
null
;
}
@Override
protected
final
boolean
isEntityUpdateable
()
{
return
true
;
}
}
app/src/main/java/com/oo/eye/gen/EyeHistroyBeanDao.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
gen
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteStatement
;
import
org.greenrobot.greendao.AbstractDao
;
import
org.greenrobot.greendao.Property
;
import
org.greenrobot.greendao.internal.DaoConfig
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.database.DatabaseStatement
;
import
com.oo.eye.bean.EyeHistroyBean
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "EYE_HISTROY_BEAN".
*/
public
class
EyeHistroyBeanDao
extends
AbstractDao
<
EyeHistroyBean
,
Long
>
{
public
static
final
String
TABLENAME
=
"EYE_HISTROY_BEAN"
;
/**
* Properties of entity EyeHistroyBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public
static
class
Properties
{
public
final
static
Property
Id
=
new
Property
(
0
,
Long
.
class
,
"id"
,
true
,
"_id"
);
public
final
static
Property
Left_eye
=
new
Property
(
1
,
double
.
class
,
"left_eye"
,
false
,
"LEFT_EYE"
);
public
final
static
Property
Right_eye
=
new
Property
(
2
,
double
.
class
,
"right_eye"
,
false
,
"RIGHT_EYE"
);
public
final
static
Property
Left_line
=
new
Property
(
3
,
int
.
class
,
"left_line"
,
false
,
"LEFT_LINE"
);
public
final
static
Property
Right_line
=
new
Property
(
4
,
int
.
class
,
"right_line"
,
false
,
"RIGHT_LINE"
);
public
final
static
Property
Created_time
=
new
Property
(
5
,
long
.
class
,
"created_time"
,
false
,
"CREATED_TIME"
);
public
final
static
Property
Type
=
new
Property
(
6
,
int
.
class
,
"type"
,
false
,
"TYPE"
);
}
public
EyeHistroyBeanDao
(
DaoConfig
config
)
{
super
(
config
);
}
public
EyeHistroyBeanDao
(
DaoConfig
config
,
DaoSession
daoSession
)
{
super
(
config
,
daoSession
);
}
/** Creates the underlying database table. */
public
static
void
createTable
(
Database
db
,
boolean
ifNotExists
)
{
String
constraint
=
ifNotExists
?
"IF NOT EXISTS "
:
""
;
db
.
execSQL
(
"CREATE TABLE "
+
constraint
+
"\"EYE_HISTROY_BEAN\" ("
+
//
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ,"
+
// 0: id
"\"LEFT_EYE\" REAL NOT NULL ,"
+
// 1: left_eye
"\"RIGHT_EYE\" REAL NOT NULL ,"
+
// 2: right_eye
"\"LEFT_LINE\" INTEGER NOT NULL ,"
+
// 3: left_line
"\"RIGHT_LINE\" INTEGER NOT NULL ,"
+
// 4: right_line
"\"CREATED_TIME\" INTEGER NOT NULL UNIQUE ,"
+
// 5: created_time
"\"TYPE\" INTEGER NOT NULL );"
);
// 6: type
}
/** Drops the underlying database table. */
public
static
void
dropTable
(
Database
db
,
boolean
ifExists
)
{
String
sql
=
"DROP TABLE "
+
(
ifExists
?
"IF EXISTS "
:
""
)
+
"\"EYE_HISTROY_BEAN\""
;
db
.
execSQL
(
sql
);
}
@Override
protected
final
void
bindValues
(
DatabaseStatement
stmt
,
EyeHistroyBean
entity
)
{
stmt
.
clearBindings
();
Long
id
=
entity
.
getId
();
if
(
id
!=
null
)
{
stmt
.
bindLong
(
1
,
id
);
}
stmt
.
bindDouble
(
2
,
entity
.
getLeft_eye
());
stmt
.
bindDouble
(
3
,
entity
.
getRight_eye
());
stmt
.
bindLong
(
4
,
entity
.
getLeft_line
());
stmt
.
bindLong
(
5
,
entity
.
getRight_line
());
stmt
.
bindLong
(
6
,
entity
.
getCreated_time
());
stmt
.
bindLong
(
7
,
entity
.
getType
());
}
@Override
protected
final
void
bindValues
(
SQLiteStatement
stmt
,
EyeHistroyBean
entity
)
{
stmt
.
clearBindings
();
Long
id
=
entity
.
getId
();
if
(
id
!=
null
)
{
stmt
.
bindLong
(
1
,
id
);
}
stmt
.
bindDouble
(
2
,
entity
.
getLeft_eye
());
stmt
.
bindDouble
(
3
,
entity
.
getRight_eye
());
stmt
.
bindLong
(
4
,
entity
.
getLeft_line
());
stmt
.
bindLong
(
5
,
entity
.
getRight_line
());
stmt
.
bindLong
(
6
,
entity
.
getCreated_time
());
stmt
.
bindLong
(
7
,
entity
.
getType
());
}
@Override
public
Long
readKey
(
Cursor
cursor
,
int
offset
)
{
return
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getLong
(
offset
+
0
);
}
@Override
public
EyeHistroyBean
readEntity
(
Cursor
cursor
,
int
offset
)
{
EyeHistroyBean
entity
=
new
EyeHistroyBean
(
//
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getLong
(
offset
+
0
),
// id
cursor
.
getDouble
(
offset
+
1
),
// left_eye
cursor
.
getDouble
(
offset
+
2
),
// right_eye
cursor
.
getInt
(
offset
+
3
),
// left_line
cursor
.
getInt
(
offset
+
4
),
// right_line
cursor
.
getLong
(
offset
+
5
),
// created_time
cursor
.
getInt
(
offset
+
6
)
// type
);
return
entity
;
}
@Override
public
void
readEntity
(
Cursor
cursor
,
EyeHistroyBean
entity
,
int
offset
)
{
entity
.
setId
(
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getLong
(
offset
+
0
));
entity
.
setLeft_eye
(
cursor
.
getDouble
(
offset
+
1
));
entity
.
setRight_eye
(
cursor
.
getDouble
(
offset
+
2
));
entity
.
setLeft_line
(
cursor
.
getInt
(
offset
+
3
));
entity
.
setRight_line
(
cursor
.
getInt
(
offset
+
4
));
entity
.
setCreated_time
(
cursor
.
getLong
(
offset
+
5
));
entity
.
setType
(
cursor
.
getInt
(
offset
+
6
));
}
@Override
protected
final
Long
updateKeyAfterInsert
(
EyeHistroyBean
entity
,
long
rowId
)
{
entity
.
setId
(
rowId
);
return
rowId
;
}
@Override
public
Long
getKey
(
EyeHistroyBean
entity
)
{
if
(
entity
!=
null
)
{
return
entity
.
getId
();
}
else
{
return
null
;
}
}
@Override
public
boolean
hasKey
(
EyeHistroyBean
entity
)
{
return
entity
.
getId
()
!=
null
;
}
@Override
protected
final
boolean
isEntityUpdateable
()
{
return
true
;
}
}
app/src/main/java/com/oo/eye/mvp/PresenterFactory.java
View file @
29fded3a
package
com
.
oo
.
eye
.
mvp
;
import
com.oo.eye.mvp.contract.EyeChartsContract
;
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.EyeChartsPresenter
;
import
com.oo.eye.mvp.presenter.EyeHistroyPresenter
;
import
com.oo.eye.mvp.presenter.EyeMainPresenter
;
import
com.oo.eye.mvp.presenter.EyeTestPresenter
;
...
...
@@ -23,10 +21,6 @@ public class PresenterFactory {
new
EyeHistroyPresenter
(
view
);
}
public
static
void
createEyeChartsPresenter
(
EyeChartsContract
.
View
view
){
new
EyeChartsPresenter
(
view
);
}
public
static
EyeMainContract
.
Presenter
createEyeMainPresenter
(
EyeMainContract
.
View
view
){
return
new
EyeMainPresenter
(
view
);
}
...
...
app/src/main/java/com/oo/eye/mvp/contract/EyeChartsContract.java
deleted
100644 → 0
View file @
800d36f6
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.EyeChartsBean
;
import
java.util.List
;
/**
* Created by xucon on 2017/12/26.
*/
public
interface
EyeChartsContract
{
interface
View
extends
BaseView
<
Presenter
>
{
public
void
getEyeChartsSuccee
(
List
<
EyeChartsBean
>
beans
);
public
void
getEyeChartsFail
(
String
msg
);
}
interface
Presenter
extends
BasePresenter
{
public
void
getEyeChartsData
(
Context
context
,
int
limit
);
}
}
app/src/main/java/com/oo/eye/mvp/contract/EyeHistroyContract.java
View file @
29fded3a
...
...
@@ -4,11 +4,9 @@ import android.content.Context;
import
com.app.baselibrary.base.mvp.BasePresenter
;
import
com.app.baselibrary.base.mvp.BaseView
;
import
com.oo.eye.bean.EyeHistroyBean
;
import
com.oo.seex.netlibrary.net.response.Page
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by xucon on 2017/12/26.
...
...
@@ -16,12 +14,11 @@ import java.util.List;
public
interface
EyeHistroyContract
{
interface
View
extends
BaseView
<
Presenter
>
{
public
void
getEyeHistroyDBSuccee
(
List
<
EyeHistroyBean
>
beans
,
int
page
,
int
count
);
public
void
getEyeHistroyNetSuccee
(
ArrayList
<
EyeHistroyBean
>
beans
,
Page
page
);
public
void
getEyeHistroyNetSuccee
(
ArrayList
<
StudentBean
>
beans
);
public
void
getEyeHistroyFail
(
String
msg
);
}
interface
Presenter
extends
BasePresenter
{
public
void
getEyeHistroy
(
Context
context
,
boolean
isNet
,
int
page
,
int
limit
);
public
void
getEyeHistroy
(
Context
context
);
}
}
app/src/main/java/com/oo/eye/mvp/presenter/EyeChartsPresenter.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
mvp
.
presenter
;
import
android.content.Context
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.bean.EyeChartsBean
;
import
com.oo.eye.db.DbManager
;
import
com.oo.eye.gen.EyeChartsBeanDao
;
import
com.oo.eye.mvp.contract.EyeChartsContract
;
import
org.greenrobot.greendao.query.QueryBuilder
;
import
java.util.List
;
/**
* Created by xucon on 2017/12/26.
*/
public
class
EyeChartsPresenter
implements
EyeChartsContract
.
Presenter
{
private
EyeChartsContract
.
View
mView
;
public
EyeChartsPresenter
(
EyeChartsContract
.
View
view
){
this
.
mView
=
view
;
}
public
void
getEyeChartsData
(
Context
context
,
int
limit
){
if
(
EyeConfig
.
getInstance
().
isNetData
()){
getEyeChartsNet
(
limit
);
}
else
{
getEyeChartsDB
(
context
,
limit
);
}
}
private
void
getEyeChartsDB
(
Context
context
,
int
limit
){
try
{
QueryBuilder
builder
=
DbManager
.
getDaoMaster
(
context
).
newSession
().
getEyeChartsBeanDao
().
queryBuilder
();
List
<
EyeChartsBean
>
beans
=
builder
.
orderDesc
(
EyeChartsBeanDao
.
Properties
.
Created_month
).
limit
(
limit
).
build
().
list
();
if
(
mView
!=
null
&&
mView
.
isActive
())
{
mView
.
getEyeChartsSuccee
(
beans
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
if
(
mView
!=
null
&&
mView
.
isActive
())
{
mView
.
getEyeChartsFail
(
"数据加载失败"
);
}
}
}
private
void
getEyeChartsNet
(
int
limit
){
// EyeDataManager.getInstance().getEyeTestCharts(SnUtils.getSN(),limit)
// .subscribe(new RxCallback<NewResponseImpl<ArrayList<EyeChartsBean>>>() {
// @Override
// public void onSuccess(NewResponseImpl<ArrayList<EyeChartsBean>> response) {
// if(mView != null && mView.isActive()){
// if(response.isSuccess()){
// mView.getEyeChartsSuccee(response.getData());
// }else{
// mView.getEyeChartsFail("数据获取失败");
// }
// }
// }
//
// @Override
// public void onError(int errorCode, String errorMessage) {
// if(mView != null && mView.isActive()){
// mView.getEyeChartsFail("数据获取失败");
// }
// }
// });
}
}
app/src/main/java/com/oo/eye/mvp/presenter/EyeHistroyPresenter.java
View file @
29fded3a
...
...
@@ -2,14 +2,8 @@ package com.oo.eye.mvp.presenter;
import
android.content.Context
;
import
com.oo.eye.bean.EyeHistroyBean
;
import
com.oo.eye.db.DbManager
;
import
com.oo.eye.mvp.contract.EyeHistroyContract
;
import
org.greenrobot.greendao.query.QueryBuilder
;
import
java.util.List
;
/**
* Created by xucon on 2017/12/26.
*/
...
...
@@ -23,28 +17,7 @@ public class EyeHistroyPresenter implements EyeHistroyContract.Presenter {
}
private
void
getEyeHistroyDB
(
Context
context
,
int
page
,
int
limit
){
try
{
QueryBuilder
builder
=
DbManager
.
getDaoMaster
(
context
).
newSession
().
getEyeHistroyBeanDao
().
queryBuilder
();
List
<
EyeHistroyBean
>
beans
=
builder
.
limit
(
page
*
limit
).
build
().
list
();
int
count
=
builder
.
build
().
list
().
size
();
if
(
mView
!=
null
&&
mView
.
isActive
())
{
mView
.
getEyeHistroyDBSuccee
(
beans
,
page
,
count
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
if
(
mView
!=
null
&&
mView
.
isActive
())
{
mView
.
getEyeHistroyFail
(
"数据加载失败"
);
}
}
}
public
void
getEyeHistroy
(
Context
context
,
boolean
isNet
,
int
page
,
int
limit
){
if
(
isNet
){
getEyeHistroyNet
(
page
,
limit
);
}
else
{
getEyeHistroyDB
(
context
,
page
,
limit
);
}
public
void
getEyeHistroy
(
Context
context
){
}
private
void
getEyeHistroyNet
(
int
page
,
int
limit
){
...
...
app/src/main/java/com/oo/eye/net/EyeApiService.java
View file @
29fded3a
package
com
.
oo
.
eye
.
net
;
import
com.oo.eye.bean.EyeHistroyBean
;
import
com.oo.eye.bean.Student
;
import
com.oo.eye.bean.Student
Bean
;
import
com.oo.seex.netlibrary.net.response.OldResponseImpl
;
import
java.util.ArrayList
;
...
...
@@ -34,5 +34,5 @@ public interface EyeApiService {
* 获取学生信息
*/
@POST
(
NetConfig
.
CLASS_STUDENT
)
Observable
<
OldResponseImpl
<
List
<
Student
>>>
getEyeInit
(
@FieldMap
Map
<
String
,
String
>
params
);
Observable
<
OldResponseImpl
<
List
<
Student
Bean
>>>
getEyeInit
(
@FieldMap
Map
<
String
,
String
>
params
);
}
app/src/main/java/com/oo/eye/widget/ChartsView.java
deleted
100644 → 0
View file @
800d36f6
package
com
.
oo
.
eye
.
widget
;
import
android.content.Context
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.Path
;
import
android.view.View
;
import
com.oo.eye.bean.ChartsBean
;
import
com.oo.eye.bean.EyeChartsBean
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by xucon on 2017/12/28.
*/
public
class
ChartsView
extends
View
{
private
List
<
ChartsBean
>
mChartsBeen
;
private
int
height
;
private
int
width
;
private
int
yTextWidth
=
100
;
private
float
xSpace
;
private
float
ySpace
;
private
float
XTextPintSize
=
40
f
;
private
int
radius
=
30
;
private
Paint
mGesturePaint
=
new
Paint
();
private
Paint
circlePaint
=
new
Paint
();
private
Paint
xTextPaint
=
new
Paint
();
private
Paint
linePaint
=
new
Paint
();
public
static
final
float
TOP_DP
=
20
f
;
// 坐标系距离顶部的间距
public
static
final
float
BOTTOM_DP
=
20
f
;
// 坐标系距离底部的间距
public
static
final
float
LEFT_DP
=
20
f
;
// 坐标系距离左边的间距
public
static
final
float
RIGHT_DP
=
20
f
;
// 坐标系距离右边的间距
public
ChartsView
(
Context
context
,
int
width
,
int
height
){
super
(
context
);
this
.
width
=
width
;
this
.
height
=
height
;
}
@Override
protected
void
onDraw
(
Canvas
canvas
)
{
super
.
onDraw
(
canvas
);
if
(
mChartsBeen
!=
null
&&
mChartsBeen
.
size
()
>
0
)
{
xTextPaint
.
setColor
(
Color
.
WHITE
);
xTextPaint
.
setAntiAlias
(
true
);
xTextPaint
.
setStrokeWidth
(
1
);
xTextPaint
.
setTextSize
(
XTextPintSize
);
linePaint
.
setColor
(
Color
.
WHITE
);
linePaint
.
setAntiAlias
(
true
);
linePaint
.
setStrokeWidth
(
3
);
circlePaint
.
setColor
(
Color
.
parseColor
(
"#FFF67F"
));
circlePaint
.
setAntiAlias
(
true
);
circlePaint
.
setStrokeWidth
(
3
);
mGesturePaint
.
setAntiAlias
(
true
);
mGesturePaint
.
setStyle
(
Paint
.
Style
.
STROKE
);
mGesturePaint
.
setStrokeWidth
(
5
);
mGesturePaint
.
setColor
(
Color
.
parseColor
(
"#FFF67F"
));
/* 绘制x,y */
canvas
.
drawLine
(
LEFT_DP
+
yTextWidth
,
height
-
BOTTOM_DP
-
XTextPintSize
,
width
-
RIGHT_DP
,
height
-
BOTTOM_DP
-
XTextPintSize
,
linePaint
);
canvas
.
drawLine
(
LEFT_DP
+
yTextWidth
,
TOP_DP
,
LEFT_DP
+
yTextWidth
,
height
-
BOTTOM_DP
-
XTextPintSize
,
linePaint
);
Path
path
=
null
;
for
(
int
i
=
mChartsBeen
.
size
()-
1
;
i
>=
0
;
i
--)
{
ChartsBean
energy
=
mChartsBeen
.
get
(
i
);
if
(
path
==
null
){
path
=
new
Path
();
path
.
moveTo
(
energy
.
x
,
energy
.
y
);
//原点
}
else
{
path
.
lineTo
(
energy
.
x
,
energy
.
y
);
}
float
tSize
=
xTextPaint
.
measureText
(
energy
.
xText
);
canvas
.
drawCircle
(
energy
.
x
,
energy
.
y
,
radius
/
2
,
circlePaint
);
// 绘制y的 文字
canvas
.
drawText
(
energy
.
yText
,
LEFT_DP
,
energy
.
y
,
xTextPaint
);
// 绘制x的 文字
canvas
.
drawText
(
energy
.
xText
,
energy
.
x
-
tSize
/
2
,
height
-
BOTTOM_DP
,
xTextPaint
);
//画横线
canvas
.
drawLine
(
LEFT_DP
+
yTextWidth
,
energy
.
y
,
width
-
RIGHT_DP
,
energy
.
y
,
linePaint
);
//画竖线
canvas
.
drawLine
(
energy
.
x
,
TOP_DP
,
energy
.
x
,
height
-
BOTTOM_DP
-
XTextPintSize
,
linePaint
);
}
if
(
mChartsBeen
.
size
()
>
1
)
{
canvas
.
drawPath
(
path
,
mGesturePaint
);
}
}
}
public
void
setData
(
List
<
EyeChartsBean
>
data
,
boolean
isLeft
){
if
(
data
==
null
||
data
.
size
()
==
0
)
return
;
List
<
EyeChartsBean
>
beans
=
new
ArrayList
<>();
for
(
int
i
=
data
.
size
()-
1
;
i
>=
0
;
i
--){
if
(
data
.
get
(
i
)
!=
null
&&
data
.
get
(
i
).
getCreated_month
()
!=
null
){
beans
.
add
(
data
.
get
(
i
));
}
}
if
(
beans
==
null
||
beans
.
size
()
==
0
)
return
;
ArrayList
<
Double
>
values
=
new
ArrayList
<>();
Map
<
Double
,
Float
>
map
=
new
HashMap
<>();
ArrayList
<
String
>
vs
=
new
ArrayList
<>();
int
count
=
0
;
for
(
EyeChartsBean
bean
:
beans
){
if
(
isLeft
){
if
(!
vs
.
contains
(
String
.
valueOf
(
bean
.
getLeft_eye
()))){
count
++;
values
.
add
(
bean
.
getLeft_eye
());
vs
.
add
(
String
.
valueOf
(
bean
.
getLeft_eye
()));
}
}
else
{
if
(!
vs
.
contains
(
String
.
valueOf
(
bean
.
getRight_eye
()))){
count
++;
values
.
add
(
bean
.
getRight_eye
());
vs
.
add
(
String
.
valueOf
(
bean
.
getRight_eye
()));
}
}
}
xSpace
=
(
width
-
LEFT_DP
-
yTextWidth
-
RIGHT_DP
)/(
beans
.
size
()+
1
);
ySpace
=
(
height
-
TOP_DP
-
BOTTOM_DP
-
XTextPintSize
)/(
count
+
1
);
float
h
=
height
-
BOTTOM_DP
-
XTextPintSize
;
Collections
.
sort
(
values
);
for
(
int
i
=
0
;
i
<
values
.
size
()
;
i
++){
map
.
put
(
values
.
get
(
i
),
h
-
(
i
+
1
)*
ySpace
);
}
mChartsBeen
=
new
ArrayList
<>();
for
(
int
j
=
0
;
j
<
beans
.
size
();
j
++){
try
{
EyeChartsBean
bean
=
beans
.
get
(
j
);
ChartsBean
chartsBean
=
new
ChartsBean
();
chartsBean
.
x
=
LEFT_DP
+
yTextWidth
+
(
j
+
1
)
*
xSpace
;
if
(
isLeft
)
{
chartsBean
.
y
=
map
.
get
(
bean
.
getLeft_eye
());
chartsBean
.
yText
=
String
.
valueOf
(
bean
.
getLeft_eye
());
}
else
{
chartsBean
.
y
=
map
.
get
(
bean
.
getRight_eye
());
chartsBean
.
yText
=
String
.
valueOf
(
bean
.
getRight_eye
());
}
chartsBean
.
xText
=
bean
.
getCreated_month
().
substring
(
bean
.
getCreated_month
().
indexOf
(
"-"
)
+
1
,
bean
.
getCreated_month
().
length
())
+
"月"
;
mChartsBeen
.
add
(
chartsBean
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
invalidate
();
}
}
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