Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
568bf94e
authored
Mar 12, 2018
by
罗翻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决处理工单的一个bug,双向绑定与greendao有问题
parent
41499117
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
36 deletions
baseSDK/src/main/java/com/dayu/event/UserInfo.java
orderCenter/src/main/java/com/dayu/order/presenter/homeorder/HomeOrderPresenter.java
orderCenter/src/main/java/com/dayu/order/presenter/processorder/ProcessOrderContract.java
orderCenter/src/main/java/com/dayu/order/presenter/processorder/ProcessOrderPresenter.java
orderCenter/src/main/java/com/dayu/order/sqlbean/OrderInfo.java
orderCenter/src/main/java/com/dayu/order/ui/activity/ProcessOrderActivity.java
orderCenter/src/main/res/layout/activity_process_order.xml
userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomePersonFragment.java
baseSDK/src/main/java/com/dayu/event/UserInfo.java
View file @
568bf94e
package
com
.
dayu
.
event
;
import
android.databinding.BaseObservable
;
/**
* 储存用户信息的类
*
...
...
@@ -9,7 +7,7 @@ import android.databinding.BaseObservable;
* on 2017/8/28.
*/
public
class
UserInfo
extends
BaseObservable
{
public
class
UserInfo
{
/**
* 工程师账户id
*/
...
...
orderCenter/src/main/java/com/dayu/order/presenter/homeorder/HomeOrderPresenter.java
View file @
568bf94e
...
...
@@ -20,8 +20,8 @@ public class HomeOrderPresenter extends HomeOrderContract.Presenter {
@Override
public
void
onAttached
()
{
String
json
=
"{\"accessToken\":\"40f0f4fd1d52472093055433a38d4a3f\",\"accountId\":\"692\",\"accountName\":\"罗凡\",\"headerImg\":\"http://dayuoss.oss-cn-beijing.aliyuncs.com/test/sp/mobile/android/business/checkApply/3b7165643f19bbf1c1f7ca2fa69f0d6b.png?x-oss-process\\u003dstyle/pic\",\"hxAccount\":\"0915e6394a254c51b6742e04a6c6ca3f\",\"hxPwd\":\"7583t45u\",\"siteId\":\"432\",\"status\":1,\"token\":\"8eff783de36e4d2a8b7bc66709edfc42\"}"
;
UserManager
.
getInstance
().
saveUserForJson
(
json
);
//
String json ="{\"accessToken\":\"40f0f4fd1d52472093055433a38d4a3f\",\"accountId\":\"692\",\"accountName\":\"罗凡\",\"headerImg\":\"http://dayuoss.oss-cn-beijing.aliyuncs.com/test/sp/mobile/android/business/checkApply/3b7165643f19bbf1c1f7ca2fa69f0d6b.png?x-oss-process\\u003dstyle/pic\",\"hxAccount\":\"0915e6394a254c51b6742e04a6c6ca3f\",\"hxPwd\":\"7583t45u\",\"siteId\":\"432\",\"status\":1,\"token\":\"8eff783de36e4d2a8b7bc66709edfc42\"}";
//
UserManager.getInstance().saveUserForJson(json);
UserInfo
userInfo
=
UserManager
.
getInstance
().
getUser
();
mUserId
=
Integer
.
parseInt
(
userInfo
.
getAccountId
());
mSiteId
=
Integer
.
parseInt
(
userInfo
.
getSiteId
());
...
...
orderCenter/src/main/java/com/dayu/order/presenter/processorder/ProcessOrderContract.java
View file @
568bf94e
...
...
@@ -23,6 +23,13 @@ public interface ProcessOrderContract {
* @param list
*/
void
initPhotoView
(
ArrayList
<
String
>
list
);
void
clearData
();
/**
* 由于databinding和greendao结合使用引起临时改变,所以在这不使用双向绑定。
*/
void
getData
();
}
abstract
class
Presenter
extends
BasePresenter
<
View
>
{
...
...
orderCenter/src/main/java/com/dayu/order/presenter/processorder/ProcessOrderPresenter.java
View file @
568bf94e
...
...
@@ -97,11 +97,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
public
void
swtichButton
()
{
buttonState
.
set
(!
buttonState
.
get
());
if
(!
buttonState
.
get
())
{
mOrderField
.
get
().
setDoorPrice
(
""
);
mOrderField
.
get
().
setServerPrice
(
""
);
mOrderField
.
get
().
setMaterialCost
(
""
);
mOrderField
.
get
().
setOtherPrice
(
""
);
mOrderField
.
get
().
setOtherInfo
(
""
);
mView
.
clearData
();
}
MobclickAgent
.
onEvent
(
BaseApplication
.
getContext
(),
"get_customer_money"
);
}
...
...
@@ -179,6 +175,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
part
[
i
]
=
body
;
}
BaseApiFactory
.
uploadPhoto
(
part
).
subscribe
(
baseObserver
(
list
->
{
mView
.
getData
();
OrderInfo
info
=
mOrderField
.
get
();
commitOrder
(
list
,
mOrderId
,
info
.
getServerRecord
(),
mAccountId
,
isPay
,
info
.
getDoorPrice
(),
info
.
getOtherInfo
(),
...
...
@@ -191,6 +188,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
@Override
public
void
saveOrder
()
{
if
(
mImages
!=
null
&&
mImages
.
size
()
>
0
)
{
mView
.
getData
();
mOrderField
.
get
().
setImgPath
(
mImages
);
}
mOrderInfoDao
.
insertOrReplace
(
mOrderField
.
get
());
...
...
@@ -211,6 +209,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
mView
.
showDialog
();
commitPhoto
(
mImages
);
}
else
{
mView
.
getData
();
OrderInfo
info
=
mOrderField
.
get
();
commitOrder
(
null
,
mOrderId
,
info
.
getServerRecord
(),
mAccountId
,
isPay
,
info
.
getDoorPrice
(),
info
.
getOtherInfo
(),
...
...
orderCenter/src/main/java/com/dayu/order/sqlbean/OrderInfo.java
View file @
568bf94e
package
com
.
dayu
.
order
.
sqlbean
;
import
android.databinding.BaseObservable
;
import
android.databinding.Bindable
;
import
com.dayu.order.BR
;
import
org.greenrobot.greendao.annotation.Convert
;
import
org.greenrobot.greendao.annotation.Entity
;
...
...
@@ -14,7 +11,8 @@ import org.greenrobot.greendao.annotation.Property;
import
java.util.List
;
/**
* Created by luofan on 2017/11/3.
* Created by luofan
* on 2017/11/3.
*/
@Entity
...
...
@@ -75,73 +73,59 @@ public class OrderInfo extends BaseObservable {
this
.
engineerId
=
engineerId
;
}
@Bindable
public
String
getServerRecord
()
{
return
this
.
serverRecord
;
}
public
void
setServerRecord
(
String
serverRecord
)
{
this
.
serverRecord
=
serverRecord
;
notifyPropertyChanged
(
BR
.
serverRecord
);
}
@Bindable
public
String
getDoorPrice
()
{
return
this
.
doorPrice
;
}
public
void
setDoorPrice
(
String
doorPrice
)
{
this
.
doorPrice
=
doorPrice
;
notifyPropertyChanged
(
BR
.
doorPrice
);
}
@Bindable
public
String
getServerPrice
()
{
return
this
.
serverPrice
;
}
public
void
setServerPrice
(
String
serverPrice
)
{
this
.
serverPrice
=
serverPrice
;
notifyPropertyChanged
(
BR
.
serverPrice
);
}
@Bindable
public
String
getMaterialCost
()
{
return
this
.
materialCost
;
}
public
void
setMaterialCost
(
String
materialCost
)
{
this
.
materialCost
=
materialCost
;
notifyPropertyChanged
(
BR
.
materialCost
);
}
@Bindable
public
String
getOtherPrice
()
{
return
this
.
otherPrice
;
}
public
void
setOtherPrice
(
String
otherPrice
)
{
this
.
otherPrice
=
otherPrice
;
notifyPropertyChanged
(
BR
.
otherPrice
);
}
@Bindable
public
String
getOtherInfo
()
{
return
this
.
otherInfo
;
}
public
void
setOtherInfo
(
String
otherInfo
)
{
this
.
otherInfo
=
otherInfo
;
notifyPropertyChanged
(
BR
.
otherInfo
);
}
@Bindable
public
List
<
String
>
getImgPath
()
{
return
this
.
imgPath
;
}
public
void
setImgPath
(
List
<
String
>
imgPath
)
{
this
.
imgPath
=
imgPath
;
notifyPropertyChanged
(
BR
.
imgPath
);
}
}
orderCenter/src/main/java/com/dayu/order/ui/activity/ProcessOrderActivity.java
View file @
568bf94e
...
...
@@ -14,6 +14,7 @@ import com.dayu.order.R;
import
com.dayu.order.databinding.ActivityProcessOrderBinding
;
import
com.dayu.order.presenter.processorder.ProcessOrderContract
;
import
com.dayu.order.presenter.processorder.ProcessOrderPresenter
;
import
com.dayu.order.sqlbean.OrderInfo
;
import
com.dayu.utils.GlideImageLoader
;
import
com.dayu.utils.UtilsScreen
;
import
com.luck.picture.lib.PictureSelectionModel
;
...
...
@@ -38,7 +39,6 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
private
ImageView
mAddIV
;
private
List
<
LocalMedia
>
mSelectList
;
private
ArrayList
<
String
>
mImages
=
new
ArrayList
<>();
private
final
int
DELETECODE
=
0
;
@Override
public
int
getLayoutId
()
{
...
...
@@ -130,9 +130,31 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
}
}
@Override
public
void
clearData
()
{
mBind
.
etDoorInfo
.
setText
(
""
);
mBind
.
etDoorPrice
.
setText
(
""
);
mBind
.
etMaterialsPrice
.
setText
(
""
);
mBind
.
etOtherPrice
.
setText
(
""
);
mBind
.
etServePrice
.
setText
(
""
);
}
@Override
public
void
getData
()
{
OrderInfo
info
=
mPresenter
.
mOrderField
.
get
();
info
.
setDoorPrice
(
mBind
.
etDoorPrice
.
getText
().
toString
());
info
.
setMaterialCost
(
mBind
.
etMaterialsPrice
.
getText
().
toString
());
info
.
setOtherPrice
(
mBind
.
etOtherPrice
.
getText
().
toString
());
info
.
setServerPrice
(
mBind
.
etServePrice
.
getText
().
toString
());
info
.
setServerRecord
(
mBind
.
etServeInfo
.
getText
().
toString
());
info
.
setOtherInfo
(
mBind
.
etDoorInfo
.
getText
().
toString
());
mPresenter
.
mOrderField
.
set
(
info
);
}
private
void
dumpPic
()
{
Intent
intent
=
new
Intent
(
this
,
PreviewActivty
.
class
);
intent
.
putStringArrayListExtra
(
Constants
.
BUNDLE_KEY_ID
,
mImages
);
int
DELETECODE
=
0
;
startActivityForResult
(
intent
,
DELETECODE
);
}
...
...
orderCenter/src/main/res/layout/activity_process_order.xml
View file @
568bf94e
...
...
@@ -202,7 +202,7 @@
android:hint=
"@string/order_hint"
android:paddingLeft=
"@dimen/dp_13"
android:paddingTop=
"@dimen/dp_11"
android:text=
"@
=
{presenter.mOrderField.serverRecord}"
android:text=
"@{presenter.mOrderField.serverRecord}"
android:textColor=
"@color/cl_home_title_text_color"
android:textColorHint=
"@color/cl_selector_hui"
android:textSize=
"@dimen/sp_13.3"
/>
...
...
@@ -309,7 +309,7 @@
android:background=
"@null"
android:hint=
"@string/input_up_door_money"
android:inputType=
"number"
android:text=
"@
=
{presenter.mOrderField.doorPrice}"
android:text=
"@{presenter.mOrderField.doorPrice}"
android:textColor=
"@color/cl_home_title_text_color"
android:textColorHint=
"@color/cl_selector_hui"
android:textSize=
"@dimen/sp_13.3"
/>
...
...
@@ -354,7 +354,7 @@
android:background=
"@null"
android:hint=
"@string/input_up_money"
android:inputType=
"number"
android:text=
"@
=
{presenter.mOrderField.serverPrice}"
android:text=
"@{presenter.mOrderField.serverPrice}"
android:textColor=
"@color/cl_home_title_text_color"
android:textColorHint=
"@color/cl_selector_hui"
android:textSize=
"@dimen/sp_13.3"
...
...
@@ -401,7 +401,7 @@
android:background=
"@null"
android:hint=
"@string/input_cailiao_money"
android:inputType=
"number"
android:text=
"@
=
{presenter.mOrderField.materialCost}"
android:text=
"@{presenter.mOrderField.materialCost}"
android:textColor=
"@color/cl_home_title_text_color"
android:textColorHint=
"@color/cl_selector_hui"
android:textSize=
"@dimen/sp_13.3"
/>
...
...
@@ -446,7 +446,7 @@
android:background=
"@null"
android:hint=
"@string/input_other_money"
android:inputType=
"number"
android:text=
"@
=
{presenter.mOrderField.otherPrice}"
android:text=
"@{presenter.mOrderField.otherPrice}"
android:textColor=
"@color/cl_home_title_text_color"
android:textColorHint=
"@color/cl_selector_hui"
android:textSize=
"@dimen/sp_13.3"
/>
...
...
@@ -480,7 +480,7 @@
android:gravity=
"top"
android:hint=
"@string/tv_order_other"
android:paddingTop=
"@dimen/dp_11"
android:text=
"@
=
{presenter.mOrderField.otherInfo}"
android:text=
"@{presenter.mOrderField.otherInfo}"
android:textColor=
"@color/cl_home_title_text_color"
android:textColorHint=
"@color/cl_selector_hui"
android:textSize=
"@dimen/sp_13.3"
/>
...
...
userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomePersonFragment.java
View file @
568bf94e
...
...
@@ -32,7 +32,8 @@ import com.dayu.widgets.CustomDialog;
import
com.umeng.analytics.MobclickAgent
;
/**
* Created by luofan on 2017/11/20.
* Created by luofan
* on 2017/11/20.
*/
public
class
HomePersonFragment
extends
BaseFragment
<
HomePersonPresenter
,
FragmentPersonalCenterBinding
>
...
...
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