Commit c95edcb3 by 罗翻

部分类实现mvvm

parent 4ffdfe68
Showing with 777 additions and 1258 deletions
......@@ -213,6 +213,14 @@ public static java.lang.String TABLENAME;
public static final int *;
}
-keep class com.umeng.error.UMError{ public *; }
-keep class com.umeng.error.UMErrorCatch{public *; }
-keep class com.umeng.error.UMErrorDataManger{ public *; }
-keep class com.umeng.error.BatteryUtils{ public *; }
#eventbus
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
......
......@@ -180,7 +180,7 @@
android:screenOrientation="portrait"
/>
<activity
android:name=".ui.SystemMesDetailActivity"
android:name=".ui.MessageDetailActivity"
android:screenOrientation="portrait"
/>
<activity
......
......@@ -91,6 +91,7 @@ public class Constants {
/***********************其他配置**********************************/
public final static int PAGESIZE = 10;
public final static String BUNDLE = "bundle";
//数据返回失败标识
public final static int FAILED = 1;
//相册选择照片删除时传递的key
......
......@@ -59,6 +59,40 @@ public class ServerException extends Exception {
case "SETTLEMENT0001":
message = MyApplication.getContext().getString(R.string.perameter_is_null);
break;
/**全局错误*/
case "GLOBAL0001":
message = "未知错误GLOBAL0001";
break;
case "GLOBAL0002":
message = "未知错误GLOBAL0002";
break;
case "GLOBAL0003":
message = "未知错误GLOBAL0003";
break;
case "GLOBAL0004":
message = "未知错误GLOBAL0004";
break;
case "GLOBAL0400":
message = "未知错误GLOBAL0400";
break;
case "GLOBAL0406":
message = "未知错误GLOBAL0406";
break;
case "GLOBAL1001":
message = "未知错误GLOBAL1001";
break;
case "GLOBAL1002":
message = "未知错误GLOBAL1002";
break;
case "GLOBAL1003":
message = "未知错误GLOBAL1003";
break;
case "GLOBAL1004":
message = "未知错误GLOBAL1004";
break;
case "GLOBAL1005":
message = "未知错误GLOBAL1005";
break;
default:
message = MyApplication.getContext().getString(R.string.get_info_failed);
break;
......
......@@ -44,15 +44,22 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
}
mDisposable.dispose();
}
public void showToast(String msg) {
ToastUtils.showShortToast(msg);
}
public void showToast(int resId) {
ToastUtils.showShortToast(resId);
}
public void showDialog() {
ProgressUtil.startLoad(this);
}
public void showDialog(String str) {
ProgressUtil.startLoad(this, str);
}
public void hideDialog() {
ProgressUtil.stopLoad();
}
......
......@@ -37,6 +37,10 @@ public abstract class BaseFragment<P extends BasePresenter, B extends ViewDataBi
if (mPresenter != null) mPresenter.onDetached();
}
public void showToast(int resId) {
ToastUtils.showShortToast(resId);
}
public void showToast(String msg) {
ToastUtils.showShortToast(msg);
}
......@@ -44,8 +48,12 @@ public abstract class BaseFragment<P extends BasePresenter, B extends ViewDataBi
public void showDialog() {
ProgressUtil.startLoad(mActivity);
}
public void showDialog(String str) {
ProgressUtil.startLoad(mActivity,str);
}
public void hideDialog() {
ProgressUtil.stopLoad();
}
}
......@@ -2,8 +2,10 @@ package com.dayu.bigfish.base;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.ui.LoginActivity;
......@@ -41,13 +43,6 @@ public abstract class BasePresenter<V> {
mComDisposable.dispose();
}
public void dumpBack() {
if (mView instanceof BaseActivity) {
((BaseActivity) mView).dumbBack();
}
}
/**
* 创建观察者
*
......@@ -55,15 +50,15 @@ public abstract class BasePresenter<V> {
* @return
*/
public <V> Observer baseObserver(final Consumer<? super V> consumer) {
return new Observer<V>() {
public <M> Observer baseObserver(final Consumer<? super M> consumer) {
return new Observer<M>() {
@Override
public void onSubscribe(Disposable d) {
mComDisposable.add(d);
}
@Override
public void onNext(V o) {
public void onNext(M o) {
ProgressUtil.stopLoad();
try {
consumer.accept(o);
......@@ -92,15 +87,15 @@ public abstract class BasePresenter<V> {
* @return
*/
public <V> Observer baseObserver(final Consumer<? super V> consumer, final Consumer<APIException.ResponeThrowable> tconsumer) {
return new Observer<V>() {
public <M> Observer baseObserver(final Consumer<? super M> consumer, final Consumer<APIException.ResponeThrowable> tconsumer) {
return new Observer<M>() {
@Override
public void onSubscribe(Disposable d) {
mComDisposable.add(d);
}
@Override
public void onNext(V o) {
public void onNext(M o) {
ProgressUtil.stopLoad();
try {
consumer.accept(o);
......@@ -172,4 +167,58 @@ public abstract class BasePresenter<V> {
.setOneButton(true);
mDialog.show();
}
public void dumpBack() {
if (mView instanceof BaseActivity) {
((BaseActivity) mView).dumbBack();
}
}
/**
* 跳转页面
*
* @param clz 所跳转的目的Activity类
*/
public void startActivity(Class<?> clz) {
mActivity.startActivity(new Intent(mActivity, clz));
}
/**
* 跳转页面
*
* @param clz 所跳转的目的Activity类
* @param bundle 跳转所携带的信息
*/
public void startActivity(Class<?> clz, Bundle bundle) {
Intent intent = new Intent(mActivity, clz);
if (bundle != null) {
intent.putExtra(Constants.BUNDLE, bundle);
}
mActivity.startActivity(intent);
}
/**
* 跳转页面
*
* @param clz 所跳转的目的Activity类
*/
public void startActvityAndFinish(Class<?> clz) {
mActivity.startActivity(new Intent(mActivity, clz));
mActivity.finish();
}
/**
* 跳转页面
*
* @param clz 所跳转的目的Activity类
* @param bundle 跳转所携带的信息
*/
public void startActivityAndFinish(Class<?> clz, Bundle bundle) {
Intent intent = new Intent(mActivity, clz);
if (bundle != null) {
intent.putExtra(Constants.BUNDLE, bundle);
}
mActivity.startActivity(intent);
mActivity.finish();
}
}
package com.dayu.bigfish.base;
import android.support.annotation.StringRes;
/**
* Created by luofan on 17/11/02.
*/
public interface BaseView {
void showToast(@StringRes int resId);
void showToast(String str);
void showDialog();
void showDialog(String str);
void hideDialog();
}
......@@ -22,6 +22,7 @@ public abstract class DataBindingFragment<B extends ViewDataBinding> extends Fra
private boolean isFirstLoad = true;
protected CompositeDisposable mDisposable = new CompositeDisposable();
@Override
public void onAttach(Context context) {
super.onAttach(context);
......
package com.dayu.bigfish.base;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.dayu.bigfish.utils.InstanceUtil;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.ToastUtils;
import java.lang.reflect.ParameterizedType;
import io.reactivex.disposables.CompositeDisposable;
/**
* Created by luofan on 17/11/02.
*/
public abstract class PreBaseActivity<P extends BasePresenter> extends AppCompatActivity {
public P mPresenter;
protected Activity mActivity;
protected CompositeDisposable mDisposable = new CompositeDisposable();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(this.getLayoutId());
mActivity = this;
if (this instanceof BaseView &&
this.getClass().getGenericSuperclass() instanceof ParameterizedType &&
((ParameterizedType) (this.getClass().getGenericSuperclass())).getActualTypeArguments().length > 0) {
Class mPresenterClass = (Class) ((ParameterizedType) (this.getClass()
.getGenericSuperclass())).getActualTypeArguments()[0];
mPresenter = InstanceUtil.getInstance(mPresenterClass);
if (mPresenter != null) mPresenter.setView(this, mActivity);
}
this.initView();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mPresenter != null) {
mPresenter.onDetached();
}
mDisposable.dispose();
}
@Override
public void setContentView(int layoutResID) {
super.setContentView(layoutResID);
}
public abstract int getLayoutId();
public abstract void initView();
public void showToast(String msg) {
ToastUtils.showShortToast(msg);
}
public void showDialog() {
ProgressUtil.startLoad(this);
}
public void hideDialog() {
ProgressUtil.stopLoad();
}
}
package com.dayu.bigfish.base;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.dayu.bigfish.utils.InstanceUtil;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.ToastUtils;
import java.lang.reflect.ParameterizedType;
import io.reactivex.disposables.CompositeDisposable;
/**
* Created by luo on 2017/11/14.
*/
public abstract class PreBaseFragment<P extends BasePresenter> extends Fragment {
protected Activity mActivity;
public P mPresenter;
private boolean isVisible; //是否可见状态
private boolean isPrepared; //标志位,View已经初始化完成。
private boolean isFirstLoad = true;
protected CompositeDisposable mDisposable = new CompositeDisposable();
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
onAttachToContext((Activity) context);
}
}
@SuppressWarnings("deprecation")
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
onAttachToContext(activity);
}
}
private void onAttachToContext(Activity context) {
mActivity = context;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isFirstLoad = true;
isPrepared = true;
if (this instanceof BaseView &&
this.getClass().getGenericSuperclass() instanceof ParameterizedType &&
((ParameterizedType) (this.getClass().getGenericSuperclass())).getActualTypeArguments().length > 0) {
Class mPresenterClass = (Class) ((ParameterizedType) (this.getClass()
.getGenericSuperclass())).getActualTypeArguments()[0];
mPresenter = InstanceUtil.getInstance(mPresenterClass);
if (mPresenter != null) mPresenter.setView(this, mActivity);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(getLayoutId(), container, false);
initView(view);
return view;
}
@Override
public void onDestroy() {
super.onDestroy();
if (mPresenter != null) mPresenter.onDetached();
mDisposable.dispose();
}
public abstract View initView(View view);
public abstract int getLayoutId();
/**
* 如果是与ViewPager一起使用,调用的是setUserVisibleHint
*/
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (getUserVisibleHint()) {
isVisible = true;
onVisible();
} else {
isVisible = false;
onInvisible();
}
}
/**
* 如果是通过FragmentTransaction的show和hide的方法来控制显示,调用的是onHiddenChanged.
* 若是初始就show的Fragment 为了触发该事件 需要先hide再show
*/
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden) {
isVisible = true;
onVisible();
} else {
isVisible = false;
onInvisible();
}
}
protected void onVisible() {
doInit();
}
protected void onInvisible() {
}
protected void doInit() {
if (!isPrepared || !isVisible || !isFirstLoad) {
return;
}
isFirstLoad = false;
lazyLoad();
}
protected abstract void lazyLoad();
public void showToast(String msg) {
ToastUtils.showShortToast(msg);
}
public void showDialog() {
ProgressUtil.startLoad(mActivity);
}
public void hideDialog() {
ProgressUtil.stopLoad();
}
}
......@@ -2,7 +2,6 @@ package com.dayu.bigfish.presenter.AppointmentOrder;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
......@@ -22,17 +21,11 @@ public class AppointmentPresenter extends AppointmentContract.Presenter {
@Override
public void getWatingOrder(int state, int userId, int siteId, int page, int pageSize) {
// ApiFactory.getReceiveOrders(state, userId, siteId, page, pageSize)
ApiFactory.getOrders(state, userId, siteId, page, pageSize).subscribe(baseObserver(new Consumer<BasePageBean<Order>>() {
@Override
public void accept(BasePageBean<Order> orderBasePageBean) throws Exception {
mView.getWatingOrderSuccess(orderBasePageBean);
}
}, new Consumer<APIException.ResponeThrowable>() {
@Override
public void accept(APIException.ResponeThrowable responeThrowable) throws Exception {
mView.getWatingOrderFial();
}
}));
}, responeThrowable -> mView.getWatingOrderFial()));
}
}
......@@ -3,9 +3,6 @@ package com.dayu.bigfish.presenter.Withdrawals;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.AlipayInfo;
import okhttp3.RequestBody;
/**
* Created by luo on 2016/8/4.
......@@ -13,24 +10,15 @@ import okhttp3.RequestBody;
public interface WithdrawalsContract {
interface View extends BaseView {
void querSuccess(AlipayInfo info);
void boundSuccess(boolean flag);
void modifySuccess(boolean flag);
/**
* 提交信息.
*/
void comfirm();
}
abstract class Presenter extends BasePresenter<View> {
public abstract void querAlipay(int userId);
public abstract void querAlipay();
public abstract void boundAlipay(RequestBody body);
public abstract void boundAlipay();
public abstract void modifyAlipay(RequestBody body);
public abstract void modifyAlipay();
/**
* 提交信息.
......
package com.dayu.bigfish.presenter.Withdrawals;
import android.databinding.ObservableField;
import android.text.TextUtils;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.bean.AlipayInfo;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.utils.UtilsUserAccountMatcher;
import com.dayu.bigfish.utils.managers.UserManager;
import org.json.JSONObject;
import java.util.HashMap;
import io.reactivex.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
......@@ -12,43 +25,93 @@ import okhttp3.RequestBody;
*/
@InstanceFactory
public class WithdrawalsPresenter extends WithdrawalsContract.Presenter {
private int mUserId;
private RequestBody mBody;
public ObservableField<String> mAccount = new ObservableField<>();
public ObservableField<String> mName = new ObservableField<>();
public ObservableField<String> mPhone = new ObservableField<>();
public ObservableField<Integer> mState = new ObservableField<>(0);//0:绑定//1.修改
@Override
public void onAttached() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mUserId = Integer.parseInt(userInfo.getAccountId());
mView.showDialog();
querAlipay();
}
@Override
public void querAlipay(int userId) {
ApiFactory.queryAlipay(userId).subscribe(baseObserver(new Consumer<AlipayInfo>() {
public void querAlipay() {
ApiFactory.queryAlipay(mUserId).subscribe(baseObserver(new Consumer<AlipayInfo>() {
@Override
public void accept(AlipayInfo info) throws Exception {
mView.querSuccess(info);
mAccount.set(info.getAlipayAccount());
mName.set(info.getAlipayName());
mPhone.set(info.getAlipayMobile());
mState.set(1);
}
}));
}
@Override
public void boundAlipay(RequestBody body) {
ApiFactory.boundAlipay(body).subscribe(baseObserver(new Consumer<Boolean>() {
public void boundAlipay() {
ApiFactory.boundAlipay(mBody).subscribe(baseObserver(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
mView.boundSuccess(aBoolean);
mView.showToast(R.string.comfirm_alipay_account_success);
mActivity.finish();
}
}));
}
@Override
public void modifyAlipay(RequestBody body) {
ApiFactory.modifyAlipay(body).subscribe(baseObserver(new Consumer<Boolean>() {
public void modifyAlipay() {
ApiFactory.modifyAlipay(mBody).subscribe(baseObserver(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
mView.modifySuccess(aBoolean);
mView.showToast(R.string.comfirm_alipay_account_success);
mActivity.finish();
}
}));
}
@Override
public void comfirm() {
mView.comfirm();
getInfo();
if (mBody == null) {
return;
}
if (mState.get() == 0) {
boundAlipay();
} else {
modifyAlipay();
}
}
public void getInfo() {
if (TextUtils.isEmpty(mAccount.get())) {
mView.showToast(R.string.alipay_account_null);
return;
}
if (TextUtils.isEmpty(mName.get())) {
mView.showToast(R.string.alipay_name_null);
return;
}
if (TextUtils.isEmpty(mPhone.get())) {
mView.showToast(R.string.alipay_phone_null);
return;
}
if (!UtilsUserAccountMatcher.isPhoneNum(mPhone.get())) {
mView.showToast(R.string.alipay_phone_error);
return;
}
HashMap<String, Object> params = new HashMap<>();
params.put(Constants.ACCOUNT_ID, mUserId);
params.put("alipayAccount", mAccount.get());
params.put("alipayMobile", mPhone.get());
params.put("alipayName", mName.get());
JSONObject jsonObject = new JSONObject(params);
mBody = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
}
}
package com.dayu.bigfish.presenter.accountbalance;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.AccountBalance;
/**
* Created by luo on 2016/8/4.
......@@ -12,23 +10,7 @@ import com.dayu.bigfish.bean.AccountBalance;
public interface AccountBalanceContract {
interface View extends BaseView {
/**
* 获取账户信息成功.
*
* @param balance
*/
void getBalanceSuccess(BasePageBean<AccountBalance> balance);
/**
* 获取账户列表信息失败.
*/
void getBalanceError();
/**
* 获取账户总金额.
* @return
*/
String getTotalPrice();
}
abstract class Presenter extends BasePresenter<View> {
......@@ -46,6 +28,10 @@ public interface AccountBalanceContract {
*/
public abstract void dumpToWithdrawal();
public abstract String getTotalPrice();
public abstract void refresh();
public abstract void loadMore();
}
}
package com.dayu.bigfish.presenter.accountbalance;
import android.content.Intent;
import android.databinding.ObservableField;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.AccountBalance;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.ui.WithdrawalsActivity;
import com.dayu.bigfish.utils.managers.UserManager;
import io.reactivex.functions.Consumer;
......@@ -15,10 +19,29 @@ import io.reactivex.functions.Consumer;
*/
@InstanceFactory
public class AccountBalancePresenter extends AccountBalanceContract.Presenter {
public ObservableField<String> totalPrice = new ObservableField<>();
public ObservableField datas = new ObservableField();
private int mAccoutId;
private int mPage;
@Override
public void onAttached() {
String price = "¥" + mActivity.getIntent().getIntExtra(Constants.ACCOUNT_BALANCE, 0);
totalPrice.set(price);
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mAccoutId = Integer.parseInt(userInfo.getAccountId());
refresh();
}
@Override
public void refresh() {
mPage = 1;
getAccountBalanceList(mPage, Constants.PAGESIZE, mAccoutId);
}
@Override
public void loadMore() {
getAccountBalanceList(mPage, Constants.PAGESIZE, mAccoutId);
}
@Override
......@@ -26,9 +49,10 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter {
ApiFactory.getAccountBalanceList(page, pageSize, accountId).subscribe(baseObserver(new Consumer<BasePageBean<AccountBalance>>() {
@Override
public void accept(BasePageBean<AccountBalance> accountBalanceBasePageBean) throws Exception {
mView.getBalanceSuccess(accountBalanceBasePageBean);
datas.set(accountBalanceBasePageBean);
mPage++;
}
}, throwable -> mView.getBalanceError()));
}, throwable -> datas.set(Constants.FAILED)));
}
@Override
......@@ -36,9 +60,4 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter {
Intent intent = new Intent(mActivity, WithdrawalsActivity.class);
mActivity.startActivity(intent);
}
@Override
public String getTotalPrice() {
return mView.getTotalPrice();
}
}
......@@ -3,7 +3,6 @@ package com.dayu.bigfish.presenter.feedback;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.ui.FeedBackActivity;
/**
......@@ -12,11 +11,12 @@ import com.dayu.bigfish.ui.FeedBackActivity;
public interface FeedBackContract {
interface View extends BaseView {
void comfirmSuccess();
}
abstract class Presenter extends BasePresenter<FeedBackActivity> {
public abstract void comFirmSuggist(String comment, String userName, String mobile);
abstract class Presenter extends BasePresenter<View> {
/**
* 提交反馈意见.
*/
public abstract void comFirmSuggist();
}
}
package com.dayu.bigfish.presenter.feedback;
import android.databinding.ObservableField;
import android.text.TextUtils;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.R;
import com.dayu.bigfish.utils.ToastUtils;
import com.dayu.bigfish.utils.UtilsUserAccountMatcher;
import com.dayu.bigfish.utils.managers.UserManager;
import org.json.JSONObject;
......@@ -19,32 +23,42 @@ import okhttp3.RequestBody;
*/
@InstanceFactory
public class FeedBackPresenter extends FeedBackContract.Presenter {
private String mUserName;
private String mUserMobile;
public ObservableField<String> mComment = new ObservableField<>();
@Override
public void onAttached() {
mUserName = UserManager.getInstance().getUserName(mActivity);
mUserMobile = UserManager.getInstance().getUserPhone(mActivity);
}
@Override
public void comFirmSuggist(String comment, String userName, String mobile) {
if (TextUtils.isEmpty(comment)) {
public void comFirmSuggist() {
if (TextUtils.isEmpty(mComment.get())) {
mView.showToast(mActivity.getString(R.string.input_feedback));
return;
}
if (UtilsUserAccountMatcher.containsEmoji(mComment.get())) {
ToastUtils.showShortToast(mActivity.getString(R.string.no_emoij));
return;
}
HashMap<String, Object> params = new HashMap<>();
params.put("comment", comment);
params.put("created", userName);
params.put("comment", mComment.get());
params.put("created", mUserName);
params.put("deal", 2);
params.put("mobile", mobile);
params.put("mobile", mUserMobile);
params.put("platform", 1);
params.put("status", 1);
params.put("suggestName", userName);
params.put("suggestName", mUserName);
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
ApiFactory.postFeedBack(body).subscribe(baseObserver(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
mView.comfirmSuccess();
mView.showToast(mActivity.getString(R.string.commite_success));
mActivity.finish();
}
}));
}
......
......@@ -4,7 +4,6 @@ package com.dayu.bigfish.presenter.login;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.ui.LoginActivity;
/**
......@@ -13,19 +12,13 @@ import com.dayu.bigfish.ui.LoginActivity;
public interface LoginContract {
interface View extends BaseView {
/**
* 进行倒计时.
*/
void changeCodeButton();
void changeCodeBtn();
/**
* 语音验证码变灰.
*/
void changeVoiceCodeButton();
void changeVoiceCodeBtn();
}
abstract class Presenter extends BasePresenter<LoginActivity> {
abstract class Presenter extends BasePresenter<View> {
/**
* 发送验证码.
......
package com.dayu.bigfish.presenter.login;
import android.content.Intent;
import android.databinding.ObservableField;
import android.text.TextUtils;
......@@ -34,39 +33,39 @@ public class LoginPresenter extends LoginContract.Presenter {
@Override
public void sendCode(int type) {
if (TextUtils.isEmpty(userName.get())) {
mView.showToast(mActivity.getString(R.string.phone_num_not_null));
mView.showToast(R.string.phone_num_not_null);
return;
}
if (!UtilsUserAccountMatcher.isPhoneNum(userName.get())) {
mView.showToast(mActivity.getString(R.string.please_input_phone_right));
mView.showToast(R.string.please_input_phone_right);
return;
}
mView.showDialog();
if (type == 1) {
mView.changeCodeButton();
} else if (type == 2) {
mView.changeVoiceCodeButton();
mView.changeCodeBtn();
} else {
mView.changeVoiceCodeBtn();
}
mView.showDialog();
ApiFactory.sendCode(userName.get(), type).subscribe(baseObserver(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
if (type == 1) {
mView.showToast(mActivity.getString(R.string.login_sms_success));
mView.showToast(R.string.login_sms_success);
} else if (type == 2) {
mView.showToast(mActivity.getString(R.string.login_voice_sms_success));
mView.showToast(R.string.login_voice_sms_success);
}
}
}, throwable -> mView.showToast(mActivity.getString(R.string.send_code_faile))));
}, throwable -> mView.showToast(R.string.send_code_faile)));
}
@Override
public void login() {
if (TextUtils.isEmpty(userName.get()) || TextUtils.isEmpty(password.get())) {
mView.showToast(mActivity.getString(R.string.phone_sms_not_null));
mView.showToast(R.string.phone_sms_not_null);
return;
}
if (!UtilsUserAccountMatcher.isPhoneNum(userName.get())) {
mView.showToast(mActivity.getString(R.string.please_input_phone_right));
mView.showToast(R.string.please_input_phone_right);
return;
}
mView.showDialog();
......@@ -76,7 +75,7 @@ public class LoginPresenter extends LoginContract.Presenter {
loginHx(userInfo.getHxAccount(), userInfo.getHxPwd());
dumpAndSave(userInfo);
}
}, throwable -> mView.showToast(mActivity.getString(R.string.login_faile))));
}, throwable -> mView.showToast(R.string.login_faile)));
}
@Override
......@@ -103,14 +102,11 @@ public class LoginPresenter extends LoginContract.Presenter {
@Override
public void dumpAndSave(UserInfo info) {
UserManager.getInstance().saveUser(mActivity, info);
Intent intent = new Intent(mActivity, MainActivity.class);
mActivity.startActivity(intent);
mActivity.finish();
startActvityAndFinish(MainActivity.class);
}
@Override
public void dumpAgreement() {
Intent intent = new Intent(mActivity, AgreementActivity.class);
mActivity.startActivity(intent);
startActivity(AgreementActivity.class);
}
}
......@@ -15,10 +15,6 @@ public interface messageContract {
abstract class Presenter extends BasePresenter<View> {
/**
* 初始化数据
*/
public abstract void initData();
/**
* 获取换新消息.
*
* @param hxUserId
......
......@@ -11,7 +11,7 @@ import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.NewMessage;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.ui.SystemMesDetailActivity;
import com.dayu.bigfish.ui.MessageDetailActivity;
import com.dayu.bigfish.ui.fragment.MessageFragment;
import com.dayu.bigfish.utils.UtilsDate;
import com.dayu.bigfish.utils.managers.UserManager;
......@@ -39,15 +39,10 @@ public class messagePresenter extends messageContract.Presenter {
@Override
public void onAttached() {
initData();
refresh();
}
@Override
public void initData() {
mCategory = ((MessageFragment) mView).getArguments().getInt("category", 1);
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mHxId = userInfo.getHxAccount();
refresh();
}
@Override
......@@ -111,7 +106,7 @@ public class messagePresenter extends messageContract.Presenter {
readMessage(message.getId(), 1);
view.setVisibility(View.GONE);
}
Intent intent = new Intent(mActivity, SystemMesDetailActivity.class);
Intent intent = new Intent(mActivity, MessageDetailActivity.class);
intent.putExtra(Constants.HX_MESSAGE, message);
intent.putExtra("category", message.getCategory());
mActivity.startActivity(intent);
......
package com.dayu.bigfish.presenter.receivingorder;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
/**
......@@ -14,38 +11,31 @@ import com.dayu.bigfish.bean.Order;
public interface ReceivingContract {
interface View extends BaseView {
void getReceiveOrderSuccess(BasePageBean<Order> orders);
void getReceiveOrderFail();
void receiveOrderSuccess();
void receiveOrderFail(APIException.ResponeThrowable throwable);
void receiveOrder(int orderId);
}
abstract class Presenter extends BasePresenter<View> {
/**
* 获取待接单列表.
* @param state 1:待接单.
*
* @param state 1:待接单.
* @param pagerId
* @param pagerSize
* @param siteId
* @param userId
*/
public abstract void getReceiveOrder(int state, int pagerId, int pagerSize, int siteId, int userId);
public abstract void getOrders(int state, int pagerId, int pagerSize, int siteId, int userId);
/**
* 工程师接单.
*
* @param orders
* @param engineer 工程师id.
*/
public abstract void receiveOrder(int orders, int engineer);
/**
* 接单
*/
public abstract void receiveOrder(int orderId);
public abstract void refresh();
public abstract void loadMore();
}
}
package com.dayu.bigfish.presenter.receivingorder;
import android.databinding.ObservableField;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.bean.event.RefreshApoiment;
import com.dayu.bigfish.bean.event.RefreshReceivingNum;
import com.dayu.bigfish.bean.event.SwtichFragment;
import com.dayu.bigfish.utils.managers.UserManager;
import org.greenrobot.eventbus.EventBus;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
/**
......@@ -12,20 +27,30 @@ import io.reactivex.functions.Consumer;
*/
@InstanceFactory
public class ReceivingPresenter extends ReceivingContract.Presenter {
public ObservableField datas = new ObservableField<>();
private int mTotalRows;
private Disposable mDisPosable;
private int mUserId;
private int mSiteId;
private int mPage;
@Override
public void onAttached() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mUserId = Integer.parseInt(userInfo.getAccountId());
mSiteId = Integer.parseInt(userInfo.getSiteId());
refresh();
}
@Override
public void getReceiveOrder(int state, int page, int pageSize, int siteId, int userId) {
public void getOrders(int state, int page, int pageSize, int siteId, int userId) {
ApiFactory.getOrders(state, page, pageSize, siteId, userId).subscribe(baseObserver(new Consumer<BasePageBean<Order>>() {
@Override
public void accept(BasePageBean<Order> orderBasePageBean) throws Exception {
mView.getReceiveOrderSuccess(orderBasePageBean);
getOrderSuccess(orderBasePageBean);
}
}, throwable -> mView.getReceiveOrderFail()));
}, throwable -> datas.set(Constants.FAILED)));
}
@Override
......@@ -33,16 +58,46 @@ public class ReceivingPresenter extends ReceivingContract.Presenter {
ApiFactory.receiveOrder(orders, engineer).subscribe(baseObserver(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
mView.receiveOrderSuccess();
receiveOrderSuccess();
}
}, responeThrowable -> {
mView.receiveOrderFail(responeThrowable);
if ("ORDER0002".equals(responeThrowable.subCode) || "ORDER0003".equals(responeThrowable.subCode)) {
refresh();
}
}));
}
public void getOrderSuccess(BasePageBean<Order> orderBasePageBean) {
datas.set(orderBasePageBean);
mTotalRows = orderBasePageBean.getTotalRows();
EventBus.getDefault().post(new RefreshReceivingNum(mTotalRows));
mPage++;
}
public void receiveOrderSuccess() {
int num = mTotalRows - 1;
mView.showToast(R.string.receive_order_success);
EventBus.getDefault().post(new SwtichFragment(1));
mDisPosable = Observable.timer(500, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshReceivingNum(num < 0 ? 0 : num));
EventBus.getDefault().post(new RefreshApoiment(-1));
mDisPosable.dispose();
});
mActivity.finish();
}
@Override
public void receiveOrder(int orderId) {
mView.receiveOrder(orderId);
public void refresh() {
mPage = 1;
getOrders(Constants.WATING_ORDER, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
@Override
public void loadMore() {
getOrders(Constants.WATING_ORDER, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
public int getmUserId() {
return mUserId;
}
}
......@@ -3,6 +3,7 @@ package com.dayu.bigfish.presenter.setting;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.ui.views.CustomDialog;
/**
* Created by luo on 2016/8/4.
......@@ -10,37 +11,12 @@ import com.dayu.bigfish.base.BaseView;
public interface SettingContract {
interface View extends BaseView {
void getNewVersionSuccess(String code);
/**
* 退出登录.
*/
void exite();
/**
* 清除缓存.
*/
void clearCach();
/**
* 检查更新.
*/
void checkVersion();
void showCachDialog(CustomDialog.OnCloseListener listener);
/**
* 拨打电话.
*/
void takePhone();
/**
* 跳转到关于我们.
*/
void dumpToAboutus();
/**
* 跳转到问题反馈.
*/
void dumpToFeed();
}
abstract class Presenter extends BasePresenter<View> {
......
package com.dayu.bigfish.presenter.setting;
import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.R;
import com.dayu.bigfish.ui.AboutUs;
import com.dayu.bigfish.ui.FeedBackActivity;
import com.dayu.bigfish.ui.LoginActivity;
import com.dayu.bigfish.ui.views.CustomDialog;
import com.dayu.bigfish.utils.AppUtils;
import com.dayu.bigfish.utils.DataCleanManager;
import com.dayu.bigfish.utils.managers.UserManager;
import com.hyphenate.chat.EMClient;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
/**
......@@ -13,7 +30,6 @@ public class SettingPresenter extends SettingContract.Presenter {
@Override
public void onAttached() {
}
@Override
......@@ -21,39 +37,63 @@ public class SettingPresenter extends SettingContract.Presenter {
ApiFactory.checkVersion("dayushifua_dayu").subscribe(baseObserver(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
mView.getNewVersionSuccess(s);
if (s.equals(AppUtils.getPackageNum(mActivity))) {
mView.showToast(R.string.is_newversion);
} else {
mView.showToast(mActivity.getString(R.string.newversion_code) + s);
}
}
}));
}
@Override
public void exite() {
mView.exite();
UserManager.getInstance().clearUserInfo(mActivity);
EMClient.getInstance().logout(true);
Intent Intents = new Intent(mActivity, LoginActivity.class);
Intents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
mActivity.startActivity(Intents);
}
@Override
public void clearCach() {
mView.clearCach();
mView.showCachDialog(new CustomDialog.OnCloseListener() {
@Override
public void onClick(Dialog dialog, boolean confirm) {
if (confirm) {
mView.showDialog(mActivity.getString(R.string.on_clear));
Observable.timer(2, TimeUnit.SECONDS).subscribe(
along -> {
mView.hideDialog();
mView.showToast(R.string.clear_success);
});
DataCleanManager.deleteFolderFile(Environment.getExternalStorageDirectory() + "/Android/data/com.dayu.bigfish/cache", false);
}
}
});
}
@Override
public void checkVersion() {
mView.checkVersion();
mView.showDialog();
updataVersion();
}
@Override
public void takePhone() {
mView.takePhone();
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:400-0086-898"));
mActivity.startActivity(intent);
}
@Override
public void dumpToAboutus() {
mView.dumpToAboutus();
startActivity(AboutUs.class);
}
@Override
public void dumpToFeed() {
mView.dumpToFeed();
startActivity(FeedBackActivity.class);
}
}
package com.dayu.bigfish.presenter.subcribeTime;
import com.dayu.bigfish.api.APIException;
import com.bigkoo.pickerview.TimePickerView;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.ui.SubcribeTimeActivity;
......@@ -12,29 +12,11 @@ import com.dayu.bigfish.ui.SubcribeTimeActivity;
public interface SubcribeContract {
interface View extends BaseView {
void subcribeTimeSuccess();
/**
* 预约时间.
*/
void subcribeTime();
/**
* 选择日期.
*/
void selectDay();
/**
* 选择时间.
*
*/
void selectTime();
void selectTime(TimePickerView.Type type, TimePickerView.OnTimeSelectListener listener);
/**
* 预约时间失败.
* @param responeThrowable
*/
void subcribeTimeFail(APIException.ResponeThrowable responeThrowable);
}
abstract class Presenter extends BasePresenter<SubcribeTimeActivity> {
......@@ -54,8 +36,7 @@ public interface SubcribeContract {
/**
* 选择时间.
*
* @param day
*/
public abstract void selectTime(String day);
public abstract void selectTime();
}
}
package com.dayu.bigfish.presenter.subcribeTime;
import android.databinding.ObservableField;
import android.text.TextUtils;
import android.view.View;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.bigkoo.pickerview.TimePickerView;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.bean.event.OrderState;
import com.dayu.bigfish.bean.event.RefreshApoiment;
import com.dayu.bigfish.bean.event.RefreshServe;
import com.dayu.bigfish.bean.event.RefreshTab;
import com.dayu.bigfish.utils.UtilsDate;
import com.dayu.bigfish.utils.UtilsUserAccountMatcher;
import org.greenrobot.eventbus.EventBus;
import java.text.ParseException;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.ORDER_DOING;
import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.ORDER_YUYUE;
import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.SUBCRIBE_TIME;
import static com.dayu.bigfish.utils.UtilsDate.LONG_DATE;
import static com.dayu.bigfish.utils.UtilsDate.LONG_DATE_FORMAT;
import static com.dayu.bigfish.utils.UtilsDate.LONG_TIME_FORMAT_TWO;
/**
* Created by luofan on 2017/11/16.
*/
@InstanceFactory
public class SubcribeTimePresenter extends SubcribeContract.Presenter {
public ObservableField<String> mInfo = new ObservableField<>("");
public ObservableField<String> mDay = new ObservableField<>();
public ObservableField<String> mHour = new ObservableField<>();
public ObservableField<String> mTitle = new ObservableField<>();
private int mOrderId;
private Disposable mDisposable;
private int mPosition;
private int mState;
private String mTime;
private boolean mIsToday;
private TimePickerView.Type mType;
@Override
public void onAttached() {
mOrderId = mActivity.getIntent().getIntExtra(Constants.ORDER_ID, 0);
mPosition = mActivity.getIntent().getIntExtra(Constants.ORDER_POSTION, 0);
mState = mActivity.getIntent().getIntExtra(Constants.ORDER_STATE, 0);
if (mState == SUBCRIBE_TIME) {
mTitle.set(mActivity.getString(R.string.tv_home_tab_one_subscribe_time));
} else if (mState == ORDER_YUYUE) {
mTitle.set(mActivity.getString(R.string.tv_home_tab_updata_subscribe_time));
} else if (mState == ORDER_DOING) {
mTitle.set(mActivity.getString(R.string.item_restart));
}
}
@Override
public void subcribeTime() {
if (!TextUtils.isEmpty(mInfo.get()) && UtilsUserAccountMatcher.containsEmoji(mInfo.get())) {
mView.showToast(R.string.no_emoij);
return;
}
if (TextUtils.isEmpty(mHour.get()) || TextUtils.isEmpty(mDay.get())) {
mView.showToast(R.string.input_day_time);
return;
} else {
mView.showDialog();
mView.showToast(R.string.on_commite_data);
try {
String d = UtilsDate.changeFormat(mDay.get(), LONG_DATE, LONG_DATE_FORMAT);
mTime = d + " " + mHour.get() + ":00";
} catch (ParseException e) {
e.printStackTrace();
}
subcribeTime(mOrderId, mTime, mInfo.get());
}
}
@Override
......@@ -24,32 +91,77 @@ public class SubcribeTimePresenter extends SubcribeContract.Presenter {
ApiFactory.subcriceTime(orderId, doorTime, doorComment).subscribe(baseObserver(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
mView.subcribeTimeSuccess();
mView.showToast(R.string.order_commite_success);
if (mState == SUBCRIBE_TIME) {
mView.showToast(R.string.subcribe_time_success);
EventBus.getDefault().post(new RefreshTab(1));
mDisposable = Observable.timer(500, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshApoiment(1));
EventBus.getDefault().post(new RefreshServe(1));
mDisposable.dispose();
});
} else if (mState == ORDER_YUYUE || mState == ORDER_DOING) {
EventBus.getDefault().post(new OrderState(ORDER_YUYUE, mPosition, mTime));
}
mActivity.finish();
}
}, new Consumer<APIException.ResponeThrowable>() {
@Override
public void accept(APIException.ResponeThrowable responeThrowable) throws Exception {
mView.subcribeTimeFail(responeThrowable);
}, responeThrowable -> {
if ("ORDER0004".equals(responeThrowable.subCode)) {
if (mState == SUBCRIBE_TIME) { //刷新待预约列表并跳转到已取消
EventBus.getDefault().post(new RefreshTab(3));
EventBus.getDefault().post(new RefreshApoiment(1));
} else if (mState == ORDER_YUYUE) {//刷新待服务列表并跳转到已取消
EventBus.getDefault().post(new RefreshTab(3));
EventBus.getDefault().post(new RefreshServe(1));
}
mActivity.finish();
}
}));
}
@Override
public void subcribeTime() {
mView.subcribeTime();
}
@Override
public void selectDay() {
mView.selectDay();
mType = TimePickerView.Type.YEAR_MONTH_DAY;
mView.selectTime(mType, this::onTimeSelect);
}
@Override
public void selectTime(String day) {
if (TextUtils.isEmpty(day)) {
mView.showToast(mActivity.getString(R.string.input_day_first));
public void selectTime() {
if (TextUtils.isEmpty(mDay.get())) {
mView.showToast(R.string.input_day_first);
return;
}
mView.selectTime();
mType = TimePickerView.Type.HOURS_MINS;
mView.selectTime(mType, this::onTimeSelect);
}
public void onTimeSelect(Date date, View v) {
if (mType == TimePickerView.Type.YEAR_MONTH_DAY) {
String time = UtilsDate.getTime(date);
if (UtilsDate.dayDiff(UtilsDate.getNowDate(), date) >= 0) {
mDay.set(time);
} else {
mView.showToast(R.string.input_right_time);
return;
}
int year = UtilsDate.getYear(date);
int month = UtilsDate.getMonth(date);
int day = UtilsDate.getDay(date);
if (year == UtilsDate.getToYear() && month == UtilsDate.getToMonth() && day == UtilsDate.getToday()) {
mIsToday = true;
} else {
mIsToday = false;
}
} else {
String nowtime = UtilsDate.getCurrDate(LONG_TIME_FORMAT_TWO);
String hour = UtilsDate.dateToString(date, LONG_TIME_FORMAT_TWO);
if (mIsToday && UtilsDate.stringtoDate(nowtime, LONG_TIME_FORMAT_TWO).getTime() - UtilsDate.stringtoDate(hour, LONG_TIME_FORMAT_TWO).getTime() >= 0) {
mView.showToast(R.string.input_right_time);
return;
} else {
mHour.set(hour);
}
}
}
}
package com.dayu.bigfish.presenter.worksRecord;
import android.text.Editable;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
/**
* Created by luo on 2016/8/4.
*/
public interface WroksRecordContract {
public interface OrderRecordContract {
interface View extends BaseView {
/**
* 获取完成订单列表成功.
*
* @param orders
*/
void getWorksRecord(BasePageBean<Order> orders);
/**
* 获取完成订单列表失败.
*/
void getWorkRecordFail();
/**
* 关闭搜索.
*/
void hideSearch();
......@@ -35,11 +19,6 @@ public interface WroksRecordContract {
* 开启搜索.
*/
void showSearch();
/**
* 搜索订单
*/
void doSearch(Editable s);
}
abstract class Presenter extends BasePresenter<View> {
......@@ -52,7 +31,7 @@ public interface WroksRecordContract {
* @param page
* @param pageSize
*/
public abstract void getWorksRecord(int state, int engineerId, int siteId, int page, int pageSize);
public abstract void getOrders(int state, int engineerId, int siteId, int page, int pageSize);
/**
* 关闭搜索.
......@@ -64,5 +43,9 @@ public interface WroksRecordContract {
*/
public abstract void showSearch();
public abstract void refresh();
public abstract void loadMore();
}
}
package com.dayu.bigfish.presenter.worksRecord;
import android.databinding.Observable;
import android.databinding.ObservableField;
import android.text.TextUtils;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.ui.OrderRecordActivity;
import com.dayu.bigfish.utils.managers.UserManager;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.functions.Consumer;
/**
* Created by luofan on 2017/11/8.
*/
@InstanceFactory
public class OrderRecordPresenter extends OrderRecordContract.Presenter {
public ObservableField datas = new ObservableField();
public ObservableField<String> serchStr = new ObservableField();
private int mPage;
private int mUserId;
private int mSiteId;
private List<Order> mList;
@Override
public void onAttached() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mUserId = Integer.parseInt(userInfo.getAccountId());
mSiteId = Integer.parseInt(userInfo.getSiteId());
serchStr.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable observable, int i) {
doSearch(serchStr.get());
}
});
refresh();
}
@Override
public void getOrders(int state, int engineerId, int siteId, int page, int pageSize) {
ApiFactory.getOrders(state, engineerId, siteId, page, pageSize).subscribe(baseObserver(new Consumer<BasePageBean<Order>>() {
@Override
public void accept(BasePageBean<Order> orderBasePageBean) throws Exception {
datas.set(orderBasePageBean);
mPage++;
}
}, throwable -> datas.set(Constants.FAILED)));
}
public void doSearch(String str) {
if (mList == null || TextUtils.isEmpty(str)) {
return;
}
ArrayList<Order> list = new ArrayList<>();
for (Order data : mList) {
if (TextUtils.isEmpty(str) || (data.getCustomerMobile().contains(str) && data.getAnyContacts() == 1)) {
list.add(data);
}
}
datas.set(list);
((OrderRecordActivity) mView).getmAdapter().setLoadMore(false);
}
@Override
public void hideSearch() {
mView.hideSearch();
}
@Override
public void showSearch() {
mList = ((OrderRecordActivity) mView).getmAdapter().getDatas();
mView.showSearch();
}
@Override
public void refresh() {
hideSearch();
mPage = 1;
getOrders(Constants.FINISH_ORDER, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
@Override
public void loadMore() {
getOrders(Constants.FINISH_ORDER, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
}
package com.dayu.bigfish.presenter.worksRecord;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import io.reactivex.functions.Consumer;
/**
* Created by luofan on 2017/11/8.
*/
@InstanceFactory
public class WorksRecordPresenter extends WroksRecordContract.Presenter {
@Override
public void onAttached() {
}
@Override
public void getWorksRecord(int state, int engineerId, int siteId, int page, int pageSize) {
ApiFactory.getOrders(state, engineerId, siteId, page, pageSize).subscribe(baseObserver(new Consumer<BasePageBean<Order>>() {
@Override
public void accept(BasePageBean<Order> orderBasePageBean) throws Exception {
mView.getWorksRecord(orderBasePageBean);
}
}, throwable -> mView.getWorkRecordFail()));
}
@Override
public void hideSearch() {
mView.hideSearch();
}
@Override
public void showSearch() {
mView.showSearch();
}
}
package com.dayu.bigfish.ui;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.AccountBalance;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.databinding.AccountbalanceLayoutBinding;
import com.dayu.bigfish.presenter.accountbalance.AccountBalanceContract;
import com.dayu.bigfish.presenter.accountbalance.AccountBalancePresenter;
import com.dayu.bigfish.utils.managers.UserManager;
/**
* Created by luofan on 2017/11/1.
......@@ -17,9 +12,6 @@ import com.dayu.bigfish.utils.managers.UserManager;
public class AccountBalanceActivity extends BaseActivity<AccountBalancePresenter, AccountbalanceLayoutBinding>
implements AccountBalanceContract.View {
private int mUserId;
private int mPage = 1;
private int mPageSize = Constants.PAGESIZE;
@Override
public int getLayoutId() {
......@@ -28,35 +20,7 @@ public class AccountBalanceActivity extends BaseActivity<AccountBalancePresenter
@Override
public void initView() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mUserId = Integer.parseInt(userInfo.getAccountId());
mPresenter.getAccountBalanceList(mPage, mPageSize, mUserId);
initData();
}
private void initData() {
mBind.rlBalance.setRefreshListener(() -> {
mPage = 1;
mPresenter.getAccountBalanceList(mPage, mPageSize, mUserId);
});
mBind.rlBalance.setOnLoadMoreListener(() -> mPresenter.getAccountBalanceList(mPage, mPageSize, mUserId));
}
@Override
public void getBalanceSuccess(BasePageBean<AccountBalance> balance) {
mPage++;
mBind.rlBalance.setPageData(balance);
}
@Override
public void getBalanceError() {
mBind.rlBalance.setDataFail();
}
@Override
public String getTotalPrice() {
int balance = getIntent().getIntExtra(Constants.ACCOUNT_BALANCE, 0);
return "¥" + balance;
mBind.rlBalance.setRefreshListener(() -> mPresenter.refresh());
mBind.rlBalance.setOnLoadMoreListener(() -> mPresenter.loadMore());
}
}
......@@ -5,9 +5,6 @@ import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.databinding.ActivityFeedbackBinding;
import com.dayu.bigfish.presenter.feedback.FeedBackContract;
import com.dayu.bigfish.presenter.feedback.FeedBackPresenter;
import com.dayu.bigfish.utils.ToastUtils;
import com.dayu.bigfish.utils.UtilsUserAccountMatcher;
import com.dayu.bigfish.utils.managers.UserManager;
/**
* 设置页面 --反馈提交
......@@ -15,10 +12,8 @@ import com.dayu.bigfish.utils.managers.UserManager;
* Created by yu
*/
public class FeedBackActivity extends BaseActivity<FeedBackPresenter, ActivityFeedbackBinding> implements FeedBackContract.View {
private String mComment;
private String userName;
private String userPhone;
public class FeedBackActivity extends BaseActivity<FeedBackPresenter, ActivityFeedbackBinding>
implements FeedBackContract.View {
@Override
public int getLayoutId() {
......@@ -27,22 +22,5 @@ public class FeedBackActivity extends BaseActivity<FeedBackPresenter, ActivityFe
@Override
public void initView() {
userName = UserManager.getInstance().getUserName(mActivity);
userPhone = UserManager.getInstance().getUserPhone(mActivity);
mBind.submitIdea.setOnClickListener(o -> {
mComment = mBind.etContent.getText().toString();
if (UtilsUserAccountMatcher.containsEmoji(mComment)) {
ToastUtils.showShortToast(getString(R.string.no_emoij));
return;
}
mPresenter.comFirmSuggist(mComment, userName, userPhone);
});
}
@Override
public void comfirmSuccess() {
ToastUtils.showShortToast(getString(R.string.commite_success));
finish();
}
}
......@@ -5,7 +5,6 @@ import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.presenter.login.LoginContract;
import com.dayu.bigfish.presenter.login.LoginPresenter;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.TimeCountUtil;
......@@ -23,21 +22,20 @@ public class LoginActivity extends BaseActivity<LoginPresenter, LoginBinding> im
@Override
public void initView() {
}
@Override
public void changeCodeButton() {
public void changeCodeBtn() {
TimeCountUtil timeCountUtil = new TimeCountUtil(mActivity, 60000, 1000, mBind.btnSendCode);
timeCountUtil.start();
ProgressUtil.startLoad(mActivity);
}
@Override
public void changeVoiceCodeButton() {
public void changeVoiceCodeBtn() {
mBind.tvVoiceCode.setTextColor(getResources().getColor(R.color.cl_text));
mBind.tvVoiceCode.setClickable(false);
}
}
......
......@@ -25,7 +25,7 @@ import static com.dayu.bigfish.utils.UtilsDate.SHORT_DATE_FORMAT;
* Created by luofan on 2017/11/27.
*/
public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessageDetailBinding> {
public class MessageDetailActivity extends DataBindingActivity<ActivityMessageDetailBinding> {
private NewMessage message;
private int mCategory;
......
......@@ -2,39 +2,25 @@ package com.dayu.bigfish.ui;
import android.content.Context;
import android.content.Intent;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.databinding.ActivityOrderRecordBinding;
import com.dayu.bigfish.presenter.worksRecord.WorksRecordPresenter;
import com.dayu.bigfish.presenter.worksRecord.WroksRecordContract;
import com.dayu.bigfish.presenter.worksRecord.OrderRecordContract;
import com.dayu.bigfish.presenter.worksRecord.OrderRecordPresenter;
import com.dayu.bigfish.ui.adapter.OrderAdapter;
import com.dayu.bigfish.utils.managers.UserManager;
import java.util.ArrayList;
/**
* 工单记录,展示已完成的订单
* on 2017/9/29.
*/
public class OrderRecordActivity extends BaseActivity<WorksRecordPresenter, ActivityOrderRecordBinding>
implements WroksRecordContract.View {
public ArrayList<Order> mList = new ArrayList<>();
private int siteId;
private int userId;
public class OrderRecordActivity extends BaseActivity<OrderRecordPresenter, ActivityOrderRecordBinding>
implements OrderRecordContract.View {
private OrderAdapter mAdapter;
private int mPage = 1;
private int mPageSize = Constants.PAGESIZE;
@Override
public int getLayoutId() {
......@@ -44,58 +30,16 @@ public class OrderRecordActivity extends BaseActivity<WorksRecordPresenter, Acti
@Override
public void initView() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
userId = Integer.parseInt(userInfo.getAccountId());
siteId = Integer.parseInt(userInfo.getSiteId());
mBind.tvTitle.setText(getString(R.string.history_order));
mAdapter = new OrderAdapter(true,R.layout.fragment_orderdoing_item);
mAdapter = new OrderAdapter(true, R.layout.fragment_orderdoing_item);
mBind.recyclerView.setAdapter(mAdapter);
initListener();
mPresenter.getWorksRecord(Constants.FINISH_ORDER, userId, siteId, mPage, mPageSize);
}
private void initListener() {
mBind.recyclerView.setRefreshListener(() -> refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> {
mPresenter.getWorksRecord(Constants.FINISH_ORDER, userId, siteId, mPage, mPageSize);
});
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
mAdapter.setOnItemClickListener((item, bind) -> dumpDetail(item.getId()));
mBind.etSeacher.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
doSearch(s);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
});
}
public void dumpDetail(int id) {
Intent intent = new Intent(OrderRecordActivity.this, OrderDetailsActivity.class);
intent.putExtra("orderId", id);
startActivity(intent);
}
@Override
public void getWorksRecord(BasePageBean<Order> oredrs) {
mPage++;
mBind.recyclerView.setPageData(oredrs);
mList = (ArrayList<Order>) mAdapter.getDatas();
}
@Override
public void getWorkRecordFail() {
mBind.recyclerView.setDataFail();
}
@Override
......@@ -117,25 +61,14 @@ public class OrderRecordActivity extends BaseActivity<WorksRecordPresenter, Acti
mBind.rlSeacher.setVisibility(View.VISIBLE);
}
@Override
public void doSearch(Editable s) {
String str = s.toString();
if (mList == null || TextUtils.isEmpty(str)) {
return;
}
ArrayList<Order> list = new ArrayList<>();
for (Order data : mList) {
if (TextUtils.isEmpty(str) || (data.getCustomerMobile().contains(str) && data.getAnyContacts() == 1)) {
list.add(data);
}
}
mBind.recyclerView.setData(list);
mAdapter.setLoadMore(false);
public void dumpDetail(int id) {
Intent intent = new Intent(mActivity, OrderDetailsActivity.class);
intent.putExtra("orderId", id);
startActivity(intent);
}
public void refresh() {
hideSearch();
mPage = 1;
mPresenter.getWorksRecord(Constants.FINISH_ORDER, userId, siteId, mPage, mPageSize);
public OrderAdapter getmAdapter() {
return mAdapter;
}
}
......@@ -54,15 +54,12 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
private int orderId;
private int engineerId;
private String brandName; //品牌名称
private String serveName; //服务类型
private int isPay = 1;//是否支付费用,默认=1 不支付费用
private String mDoorPrice;
private String mServePrice;
private String mMeterailPrice;
private String mOtherPrice;
private String mServeInfo;
private String categoryName; //产品名称
private int finshPosition;
private int mIvWeight;
private ImageView mAddIV;
......
......@@ -3,31 +3,15 @@ package com.dayu.bigfish.ui;
import android.content.Intent;
import android.view.View;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.CoreAdapter;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.bean.event.RefreshApoiment;
import com.dayu.bigfish.bean.event.RefreshReceivingNum;
import com.dayu.bigfish.bean.event.SwtichFragment;
import com.dayu.bigfish.databinding.ActivityReceivingBinding;
import com.dayu.bigfish.presenter.receivingorder.ReceivingContract;
import com.dayu.bigfish.presenter.receivingorder.ReceivingPresenter;
import com.dayu.bigfish.ui.adapter.OrderAdapter;
import com.dayu.bigfish.ui.listener.OnChildClickListener;
import com.dayu.bigfish.utils.ToastUtils;
import com.dayu.bigfish.utils.managers.UserManager;
import org.greenrobot.eventbus.EventBus;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
/**
......@@ -38,13 +22,7 @@ import io.reactivex.disposables.Disposable;
public class ReceivingActivity extends BaseActivity<ReceivingPresenter, ActivityReceivingBinding> implements
ReceivingContract.View {
private int userId;
private int siteId;
private int mPage = 1;
private int mPageSize = Constants.PAGESIZE;
private OrderAdapter mAdapter;
private int mTotalRows;
private Disposable mDisPosable;
@Override
......@@ -54,28 +32,21 @@ public class ReceivingActivity extends BaseActivity<ReceivingPresenter, Activity
@Override
public void initView() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
userId = Integer.parseInt(userInfo.getAccountId());
siteId = Integer.parseInt(userInfo.getSiteId());
mBind.tvTitle.setText(getString(R.string.receive_list));
mAdapter = new OrderAdapter(true, R.layout.fragment_orderdoing_item);
mBind.recyclerView.setAdapter(mAdapter);
mPresenter.getReceiveOrder(Constants.WATING_ORDER, userId, siteId, mPage, mPageSize);
initListener();
}
private void initListener() {
mBind.recyclerView.setRefreshListener(() -> refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> {
mPage++;
mPresenter.getReceiveOrder(Constants.WATING_ORDER, userId, siteId, mPage, mPageSize);
});
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
mAdapter.setOnChildClickListener(new OnChildClickListener() {
@Override
public void OnChildClick(View view, CoreAdapter adapter, int position) {
if (view.getId() == R.id.item_text_phone) {
Order order = (Order) adapter.getItem(position);
mPresenter.receiveOrder(order.getId(), userId);
mPresenter.receiveOrder(order.getId(), mPresenter.getmUserId());
}
}
});
......@@ -86,52 +57,6 @@ public class ReceivingActivity extends BaseActivity<ReceivingPresenter, Activity
});
}
@Override
public void getReceiveOrderSuccess(BasePageBean<Order> orders) {
mTotalRows = orders.getTotalRows();
mBind.recyclerView.setPageData(orders);
EventBus.getDefault().post(new RefreshReceivingNum(mTotalRows));
}
@Override
public void getReceiveOrderFail() {
mBind.recyclerView.setDataFail();
}
@Override
public void receiveOrderSuccess() {
int num = mTotalRows - 1;
ToastUtils.showShortToast(getString(R.string.receive_order_success));
//接单成功,刷新首页tab状态数量
EventBus.getDefault().post(new SwtichFragment(1));
mDisPosable = Observable.timer(500, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshReceivingNum(num < 0 ? 0 : num));
EventBus.getDefault().post(new RefreshApoiment(-1));
mDisPosable.dispose();
});
finish();
}
@Override
public void receiveOrderFail(APIException.ResponeThrowable throwable) {
if ("ORDER0002".equals(throwable.subCode) || "ORDER0003".equals(throwable.subCode)) {
refresh();
}
}
@Override
public void receiveOrder(int orderId) {
mPresenter.receiveOrder(orderId, userId);
}
public void refresh() {
mPage = 1;
mPresenter.getReceiveOrder(Constants.WATING_ORDER, userId, siteId, mPage, mPageSize);
}
@Override
public void finish() {
super.finish();
......
package com.dayu.bigfish.ui;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import com.dayu.bigfish.R;
......@@ -12,18 +9,10 @@ import com.dayu.bigfish.databinding.ActivitySettingBinding;
import com.dayu.bigfish.presenter.setting.SettingContract;
import com.dayu.bigfish.presenter.setting.SettingPresenter;
import com.dayu.bigfish.ui.views.CustomDialog;
import com.dayu.bigfish.utils.AppUtils;
import com.dayu.bigfish.utils.DataCleanManager;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.ToastUtils;
import com.dayu.bigfish.utils.managers.UserManager;
import com.hyphenate.EMCallBack;
import com.hyphenate.chat.EMClient;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
/**
* 设置页面
* 2017/9/2.
......@@ -39,16 +28,11 @@ public class SettingActivity extends BaseActivity<SettingPresenter, ActivitySett
return R.layout.activity_setting;
}
@Override
public void initView() {
initListener();
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mHxAccount = userInfo.getHxAccount();
mHxPwd = userInfo.getHxPwd();
}
private void initListener() {
mBind.setMessageSwitch.setOnClickListener(o -> switchButton());
}
......@@ -78,68 +62,13 @@ public class SettingActivity extends BaseActivity<SettingPresenter, ActivitySett
}
@Override
public void clearCach() {
public void showCachDialog(CustomDialog.OnCloseListener listener) {
CustomDialog dialog = new CustomDialog(mActivity, R.style.custom_dialog2, getString(R.string.sure_clear_data)
, (dialog1, confirm) -> {
if (confirm) {
ProgressUtil.startLoad(mActivity, getString(R.string.on_clear));
Observable.timer(2, TimeUnit.SECONDS).subscribe(
along -> {
ProgressUtil.stopLoad();
ToastUtils.showShortToast(getString(R.string.clear_success));
});
DataCleanManager.deleteFolderFile(Environment.getExternalStorageDirectory() + "/Android/data/com.dayu.bigfish/cache", false);
} else {
}
dialog1.dismiss();
});
, listener);
dialog.setTitle(getString(R.string.notice))
.setNegativeButton(getString(R.string.cancle))
.setPositiveButton(getString(R.string.comfirm));
dialog.show();
}
@Override
public void checkVersion() {
ProgressUtil.startLoad(mActivity);
mPresenter.updataVersion();
}
@Override
public void takePhone() {
Intent intent1 = new Intent(Intent.ACTION_DIAL);
intent1.setData(Uri.parse("tel:400-0086-898"));
startActivity(intent1);
}
@Override
public void dumpToAboutus() {
Intent intentAbout = new Intent(this, AboutUs.class);
startActivity(intentAbout);
}
@Override
public void dumpToFeed() {
Intent intentIdeaActivity = new Intent(this, FeedBackActivity.class);
startActivity(intentIdeaActivity);
}
@Override
public void getNewVersionSuccess(String code) {
if (code.equals(AppUtils.getPackageNum(mActivity))) {
ToastUtils.showShortToast(getString(R.string.is_newversion));
} else {
ToastUtils.showShortToast(getString(R.string.newversion_code) + code);
}
}
@Override
public void exite() {
UserManager.getInstance().clearUserInfo(this);
EMClient.getInstance().logout(true);
Intent Intents = new Intent(this, LoginActivity.class);
Intents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(Intents);
}
}
package com.dayu.bigfish.ui;
import android.content.Intent;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import com.bigkoo.pickerview.TimePickerView;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.bean.event.OrderState;
import com.dayu.bigfish.bean.event.RefreshApoiment;
import com.dayu.bigfish.bean.event.RefreshServe;
import com.dayu.bigfish.bean.event.RefreshTab;
import com.dayu.bigfish.databinding.ActivitySubscribeTimeBinding;
import com.dayu.bigfish.presenter.subcribeTime.SubcribeContract;
import com.dayu.bigfish.presenter.subcribeTime.SubcribeTimePresenter;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.ToastUtils;
import com.dayu.bigfish.utils.UtilsDate;
import com.dayu.bigfish.utils.UtilsUserAccountMatcher;
import org.greenrobot.eventbus.EventBus;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.ORDER_DOING;
import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.ORDER_YUYUE;
import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.SUBCRIBE_TIME;
import static com.dayu.bigfish.utils.UtilsDate.LONG_DATE;
import static com.dayu.bigfish.utils.UtilsDate.LONG_DATE_FORMAT;
import static com.dayu.bigfish.utils.UtilsDate.LONG_TIME_FORMAT_TWO;
/**
* 修改预约上门时间
......@@ -46,14 +18,6 @@ import static com.dayu.bigfish.utils.UtilsDate.LONG_TIME_FORMAT_TWO;
public class SubcribeTimeActivity extends BaseActivity<SubcribeTimePresenter, ActivitySubscribeTimeBinding>
implements SubcribeContract.View {
private int mOrderId;
private String mInfo;
private int mPosition;
private boolean mIsToday;
private int mState;
private String mTime;
private Disposable mDisposable;
@Override
public int getLayoutId() {
......@@ -63,85 +27,12 @@ public class SubcribeTimeActivity extends BaseActivity<SubcribeTimePresenter, Ac
@Override
public void initView() {
Intent intent = getIntent();
mOrderId = intent.getIntExtra(Constants.ORDER_ID, 0);
mPosition = intent.getIntExtra(Constants.ORDER_POSTION, 0);
mState = intent.getIntExtra(Constants.ORDER_STATE, 0);
if (mState == SUBCRIBE_TIME) {
mBind.tvTile.setText(getString(R.string.tv_home_tab_one_subscribe_time));
} else if (mState == ORDER_YUYUE) {
mBind.tvTile.setText(getString(R.string.tv_home_tab_updata_subscribe_time));
} else if (mState == ORDER_DOING) {
mBind.tvTile.setText(getString(R.string.item_restart));
}
}
@Override
public void subcribeTimeSuccess() {
ToastUtils.showShortToast(getString(R.string.order_commite_success));
finish();
if (mState == SUBCRIBE_TIME) {
ToastUtils.showShortToast(getString(R.string.subcribe_time_success));
EventBus.getDefault().post(new RefreshTab(1));
mDisposable = Observable.timer(500, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshApoiment(1));
EventBus.getDefault().post(new RefreshServe(1));
mDisposable.dispose();
});
} else if (mState == ORDER_YUYUE || mState == ORDER_DOING) {
EventBus.getDefault().post(new OrderState(ORDER_YUYUE, mPosition, mTime));
}
}
@Override
public void subcribeTime() {
mInfo = mBind.etInfo.getText().toString();
String time = mBind.tvTime.getText().toString().trim();
String day = mBind.tvDay.getText().toString().trim();
if (UtilsUserAccountMatcher.containsEmoji(mInfo)) {
ToastUtils.showShortToast(getString(R.string.no_emoij));
return;
}
if (TextUtils.isEmpty(time) || TextUtils.isEmpty(day)) {
ToastUtils.showShortToast(getString(R.string.input_day_time));
return;
} else {
ProgressUtil.startLoad(mActivity);
ToastUtils.showShortToast(getString(R.string.on_commite_data));
try {
String d = UtilsDate.changeFormat(day, LONG_DATE, LONG_DATE_FORMAT);
mTime = d + " " + time + ":00";
mPresenter.subcribeTime(mOrderId, mTime, mInfo);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
@Override
public void selectDay() {
TimePickerView pvTime = new TimePickerView.Builder(SubcribeTimeActivity.this, new TimePickerView.OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date2, View v) {//选中事件回调
String time = UtilsDate.getTime(date2);
if (UtilsDate.dayDiff(UtilsDate.getNowDate(), date2) >= 0) {
mBind.tvDay.setText(time);
} else {
ToastUtils.showShortToast(getString(R.string.input_right_time));
return;
}
int year = UtilsDate.getYear(date2);
int month = UtilsDate.getMonth(date2);
int day = UtilsDate.getDay(date2);
if (year == UtilsDate.getToYear() && month == UtilsDate.getToMonth() && day == UtilsDate.getToday()) {
mIsToday = true;
} else {
mIsToday = false;
}
}
})
.setType(TimePickerView.Type.YEAR_MONTH_DAY)//默认全部显示
public void selectTime(TimePickerView.Type type,TimePickerView.OnTimeSelectListener listener) {
TimePickerView pvTime = new TimePickerView.Builder(SubcribeTimeActivity.this, listener)
.setType(type)//默认全部显示
.setCancelText(getString(R.string.cancle))//取消按钮文字
.setSubmitText(getString(R.string.comfirm))//确认按钮文字
.setContentSize(20)//滚轮文字大小
......@@ -160,57 +51,4 @@ public class SubcribeTimeActivity extends BaseActivity<SubcribeTimePresenter, Ac
pvTime.show();
}
@Override
public void selectTime() {
TimePickerView pvTime2 = new TimePickerView.Builder(SubcribeTimeActivity.this, new TimePickerView.OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date2, View v) {//选中事件回调
String nowtime = UtilsDate.getCurrDate(LONG_TIME_FORMAT_TWO);
String time = UtilsDate.dateToString(date2, LONG_TIME_FORMAT_TWO);
if (mIsToday && UtilsDate.stringtoDate(nowtime, LONG_TIME_FORMAT_TWO).getTime() - UtilsDate.stringtoDate(time, LONG_TIME_FORMAT_TWO).getTime() >= 0) {
ToastUtils.showShortToast(getString(R.string.input_right_time));
return;
} else {
ToastUtils.showShortToast(time);
mBind.tvTime.setText(time);
}
}
})
.setType(TimePickerView.Type.HOURS_MINS)//默认全部显示
.setCancelText(getString(R.string.cancle))//取消按钮文字
.setSubmitText(getString(R.string.comfirm))//确认按钮文字
.setContentSize(20)//滚轮文字大小
.setTitleSize(20)//标题文字大小
// .setTitleText("请选择时间")//标题文字
.setOutSideCancelable(true)//点击屏幕,点在控件外部范围时,是否取消显示
.isCyclic(true)//是否循环滚动
.setTextColorCenter(Color.BLACK)//设置选中项的颜色
.setTitleColor(Color.BLACK)//标题文字颜色
.setSubmitColor(Color.BLUE)//确定按钮文字颜色
.setCancelColor(Color.BLUE)//取消按钮文字颜色
.isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
.isDialog(true)//是否显示为对话框样式
.build();
pvTime2.setDate(Calendar.getInstance());
pvTime2.show();
}
@Override
public void subcribeTimeFail(APIException.ResponeThrowable responeThrowable) {
if ("ORDER0004".equals(responeThrowable.subCode)) {
if (mState == SUBCRIBE_TIME) { //刷新待预约列表并跳转到已取消
EventBus.getDefault().post(new RefreshTab(3));
EventBus.getDefault().post(new RefreshApoiment(1));
} else if (mState == ORDER_YUYUE) {//刷新待服务列表并跳转到已取消
EventBus.getDefault().post(new RefreshTab(3));
EventBus.getDefault().post(new RefreshServe(1));
}
finish();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
package com.dayu.bigfish.ui;
import android.text.TextUtils;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.bean.AlipayInfo;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.databinding.ActivityWithdrawalsBinding;
import com.dayu.bigfish.presenter.Withdrawals.WithdrawalsContract;
import com.dayu.bigfish.presenter.Withdrawals.WithdrawalsPresenter;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.ToastUtils;
import com.dayu.bigfish.utils.UtilsUserAccountMatcher;
import com.dayu.bigfish.utils.managers.UserManager;
import org.json.JSONObject;
import java.util.HashMap;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* 账号绑定页面.
......@@ -29,11 +13,6 @@ import okhttp3.RequestBody;
public class WithdrawalsActivity extends BaseActivity<WithdrawalsPresenter, ActivityWithdrawalsBinding>
implements WithdrawalsContract.View {
private String mAccount;
private String mName;
private String mPhone;
private int mUserId;
private int mState = 0;//0:绑定//1.修改
@Override
public int getLayoutId() {
......@@ -42,89 +21,5 @@ public class WithdrawalsActivity extends BaseActivity<WithdrawalsPresenter, Acti
@Override
public void initView() {
UserInfo userInfo = UserManager.getInstance().getUser(mActivity);
mUserId = Integer.parseInt(userInfo.getAccountId());
ProgressUtil.startLoad(mActivity);
mPresenter.querAlipay(mUserId);
}
public RequestBody getInfo() {
mAccount = mBind.etAccout.getText().toString().trim();
mName = mBind.etName.getText().toString().trim();
mPhone = mBind.etPhone.getText().toString().trim();
if (TextUtils.isEmpty(mAccount)) {
ToastUtils.showShortToast(getString(R.string.alipay_account_null));
return null;
}
if (TextUtils.isEmpty(mName)) {
ToastUtils.showShortToast(getString(R.string.alipay_name_null));
return null;
}
if (TextUtils.isEmpty(mPhone)) {
ToastUtils.showShortToast(getString(R.string.alipay_phone_null));
return null;
}
if (!UtilsUserAccountMatcher.isPhoneNum(mPhone)) {
ToastUtils.showShortToast(getString(R.string.alipay_phone_error));
return null;
}
HashMap<String, Object> params = new HashMap<>();
params.put(Constants.ACCOUNT_ID, mUserId);
params.put("alipayAccount", mAccount);
params.put("alipayMobile", mPhone);
params.put("alipayName", mName);
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
return body;
}
@Override
public void querSuccess(AlipayInfo info) {
if (info == null) {
mState = 0;
} else {
mBind.etAccout.setText(info.getAlipayAccount());
mBind.etName.setText(info.getAlipayName());
mBind.etPhone.setText(info.getAlipayMobile());
mState = 1;
}
if (mState == 0) {
mBind.tvComfirm.setBackgroundResource(R.drawable.btn_login_selector);
mBind.tvComfirm.setText(getString(R.string.comfirm));
mBind.tvComfirm.setTextColor(getResources().getColor(R.color.cl_white));
} else {
mBind.tvComfirm.setBackgroundResource(R.drawable.btn_blue_react);
mBind.tvComfirm.setText(getString(R.string.modify_alipay_info));
mBind.tvComfirm.setTextColor(getResources().getColor(R.color.cl_receiving_order_item_data));
}
}
@Override
public void boundSuccess(boolean flag) {
ToastUtils.showShortToast(getString(R.string.comfirm_alipay_account_success));
finish();
}
@Override
public void modifySuccess(boolean flag) {
ToastUtils.showShortToast(getString(R.string.modify_alipay_account_success));
finish();
}
@Override
public void comfirm() {
if (mState == 0) {
if (getInfo() == null) {
return;
}
ProgressUtil.startLoad(mActivity);
mPresenter.boundAlipay(getInfo());
} else {
if (getInfo() == null) {
return;
}
ProgressUtil.startLoad(mActivity);
mPresenter.modifyAlipay(getInfo());
}
}
}
......@@ -3,12 +3,10 @@ package com.dayu.bigfish.ui.fragment;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.view.View;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.DataBindingFragment;
import com.dayu.bigfish.databinding.FragmentMessageBinding;
import com.dayu.bigfish.presenter.homemessage.HomeMessageContract;
import com.dayu.bigfish.ui.adapter.FragmentOrderAdapter;
import com.dayu.bigfish.utils.TabLayoutUtils;
......@@ -19,8 +17,7 @@ import java.util.List;
* Created by luofan on 2017/11/20.
*/
public class HomeMessageTabFragment extends DataBindingFragment<FragmentMessageBinding>
implements HomeMessageContract.View {
public class HomeMessageTabFragment extends DataBindingFragment<FragmentMessageBinding> {
private List<Fragment> list;
private FragmentOrderAdapter fragmentAdapter;
private int mIndex = -1;
......
......@@ -2,7 +2,6 @@ package com.dayu.bigfish.ui.views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.dayu.bigfish.R;
......@@ -11,7 +10,7 @@ import com.dayu.bigfish.R;
* on 2017/9/21.
*/
public class SwitchImage extends ImageView {
public class SwitchImage extends android.support.v7.widget.AppCompatImageView {
public boolean switchButton = true;
public boolean getSwitchButton() {
......
package com.dayu.bigfish.utils;
import android.databinding.BindingAdapter;
import android.databinding.BindingConversion;
import android.graphics.Typeface;
import android.text.TextUtils;
......@@ -19,14 +20,14 @@ import java.util.List;
* Created by luofan on 2017/12/12.
*/
public class BindingAdapter {
public class BindingUtils {
/**
* databing加载图片.
*
* @param view
* @param url
*/
@android.databinding.BindingAdapter({"imageUrl"})
@BindingAdapter({"imageUrl"})
public static void loadImage(ImageView view, String url) {
if (!TextUtils.isEmpty(url)) {
RequestOptions options = new RequestOptions()
......@@ -59,7 +60,7 @@ public class BindingAdapter {
*
* @param view
*/
@android.databinding.BindingAdapter({"setDatas"})
@BindingAdapter({"dataSours"})
public static void setDatas(LRecyclerView view, Object obj) {
if (obj instanceof BasePageBean) {
view.setPageData((BasePageBean) obj);
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
xmlns:app="http://schemas.android.com/apk/res-auto">
<data class="AccountbalanceLayoutBinding">>
<data class="AccountbalanceLayoutBinding">
<import type="com.dayu.bigfish.presenter.accountbalance.AccountBalancePresenter"/>
<import type="com.dayu.bigfish.presenter.accountbalance.AccountBalancePresenter" />
<variable
name="presenter"
type="AccountBalancePresenter"/>
type="AccountBalancePresenter" />
</data>
......@@ -20,35 +19,30 @@
<RelativeLayout
android:id="@+id/time_title"
style="@style/title"
>
style="@style/title">
<TextView
android:id="@+id/title_text"
style="@style/text_title"
android:text="@string/title_account_balance"
/>
android:text="@string/title_account_balance" />
<ImageView
android:id="@+id/title_back"
style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}"
/>
android:onClick="@{()->presenter.dumpBack()}" />
<TextView
android:id="@+id/title_right"
style="@style/title_right_text"
android:onClick="@{()->presenter.dumpToWithdrawal()}"
android:text="@string/title_account_balance_right"
android:textColor="#3faafc"
/>
android:textColor="#3faafc" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape"
/>
android:src="@drawable/line_shape" />
</RelativeLayout>
<TextView
......@@ -58,8 +52,7 @@
android:gravity="center"
android:text="@{presenter.totalPrice}"
android:textColor="#ffbe2d"
android:textSize="40sp"
/>
android:textSize="40sp" />
<ImageView
android:id="@+id/line_one"
......@@ -67,17 +60,16 @@
android:layout_height="@dimen/dp_0.3"
android:layout_centerHorizontal="true"
android:background="@color/cl_order_item_line_bg"
android:visibility="gone"
/>
android:visibility="gone" />
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/rl_balance"
dataSours="@{presenter.datas}"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:itemType="@layout/item_account_balance_layout"
app:needCoreAdapter="true"
/>
app:needCoreAdapter="true" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -2,11 +2,14 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.dayu.bigfish.presenter.feedback.FeedBackPresenter"/>
<import type="com.dayu.bigfish.presenter.feedback.FeedBackPresenter" />
<variable
name="presenter"
type="FeedBackPresenter"/>
type="FeedBackPresenter" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -15,20 +18,17 @@
<RelativeLayout
android:id="@+id/title_idea"
style="@style/title"
>
style="@style/title">
<TextView
android:id="@+id/text_idea"
style="@style/text_title"
android:text="@string/tv_idea"
/>
android:text="@string/tv_idea" />
<ImageView
android:id="@+id/title_back"
style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}"
/>
android:onClick="@{()->presenter.dumpBack()}" />
</RelativeLayout>
......@@ -37,8 +37,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_197"
android:layout_below="@id/title_idea"
android:background="@color/cl_white"
>
android:background="@color/cl_white">
<EditText
android:id="@+id/et_content"
......@@ -51,9 +50,10 @@
android:hint="@string/tv_idea_text_hint"
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_17"
android:text="@={presenter.mComment}"
android:textColor="@color/cl_home_title_text_color"
android:textColorHint="@color/cl_selector_hui"
android:textSize="@dimen/sp_13.3"/>
android:textSize="@dimen/sp_13.3" />
</RelativeLayout>
<Button
......@@ -65,9 +65,9 @@
android:layout_marginTop="@dimen/dp_50"
android:background="@drawable/btn_login_selector"
android:gravity="center"
android:onClick="@{()->presenter.comFirmSuggist()}"
android:text="@string/submit"
android:textColor="@color/cl_white"
android:textSize="@dimen/sp_15"
/>
android:textSize="@dimen/sp_15" />
</RelativeLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="com.dayu.bigfish.presenter.worksRecord.WorksRecordPresenter"/>
<import type="com.dayu.bigfish.presenter.worksRecord.OrderRecordPresenter" />
<variable
name="presenter"
type="WorksRecordPresenter"/>
type="com.dayu.bigfish.presenter.worksRecord.OrderRecordPresenter" />
</data>
<LinearLayout
......@@ -27,19 +27,18 @@
<TextView
android:id="@+id/tv_title"
style="@style/text_title"
android:text="工单记录"/>
android:text="工单记录" />
<ImageView
android:id="@+id/title_back"
style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}"
/>
android:onClick="@{()->presenter.dumpBack()}" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape"/>
android:src="@drawable/line_shape" />
<ImageView
android:id="@+id/iv_saecher"
......@@ -49,7 +48,7 @@
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:onClick="@{()->presenter.showSearch()}"
android:src="@mipmap/seacher"/>
android:src="@mipmap/seacher" />
</RelativeLayout>
<RelativeLayout
......@@ -66,12 +65,12 @@
android:layout_toRightOf="@+id/iv"
android:background="@null"
android:hint="@string/find_customer_mobile"
/>
android:text="@={presenter.serchStr}" />
<ImageView
android:id="@+id/iv"
style="@style/title_image_back"
android:src="@mipmap/seacher"/>
android:src="@mipmap/seacher" />
<TextView
android:id="@+id/tv_cancel"
......@@ -85,22 +84,22 @@
android:text="@string/cancle"
android:textColor="@color/cl_black"
android:textSize="@dimen/dp_18"
android:textStyle="bold"/>
android:textStyle="bold" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape"/>
android:src="@drawable/line_shape" />
</RelativeLayout>
</RelativeLayout>
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/recyclerView"
dataSours="@{presenter.datas}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
/>
android:background="#f5f5f5" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -44,6 +44,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
dataSours="@{presenter.datas}"
/>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -3,11 +3,11 @@
<data>
<import type="com.dayu.bigfish.presenter.subcribeTime.SubcribeTimePresenter"/>
<import type="com.dayu.bigfish.presenter.subcribeTime.SubcribeTimePresenter" />
<variable
name="presenter"
type="SubcribeTimePresenter"/>
type="SubcribeTimePresenter" />
</data>
<RelativeLayout
......@@ -17,27 +17,23 @@
<RelativeLayout
android:id="@+id/time_title"
style="@style/title"
>
style="@style/title">
<TextView
android:id="@+id/tv_tile"
style="@style/text_title"
android:text="@string/tv_home_tab_updata_subscribe_time"
/>
android:text="@{presenter.mTitle}" />
<ImageView
android:id="@+id/iv_back"
style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}"
/>
android:onClick="@{()->presenter.dumpBack()}" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape"
/>
android:src="@drawable/line_shape" />
</RelativeLayout>
<LinearLayout
......@@ -46,20 +42,18 @@
android:layout_height="wrap_content"
android:layout_below="@id/time_title"
android:layout_marginTop="@dimen/dp_10"
android:orientation="vertical"
>
android:orientation="vertical">
<TextView
style="@style/line"
/>
<TextView style="@style/line" />
<TextView style="@style/line" />
<RelativeLayout
android:id="@+id/rl_day"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:background="@color/cl_white"
android:onClick="@{()->presenter.selectDay()}"
>
android:onClick="@{()->presenter.selectDay()}">
<TextView
android:id="@+id/text_date"
......@@ -69,8 +63,7 @@
android:layout_marginLeft="@dimen/dp_13.3"
android:text="@string/tv_time_text_time"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15"
/>
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tv_day"
......@@ -80,22 +73,17 @@
android:layout_marginLeft="@dimen/dp_21.3"
android:layout_toRightOf="@id/text_date"
android:hint="@string/tv_home_tab_updata_subscribe_data"
android:text="@={presenter.mDay}"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15"
/>
android:textSize="@dimen/sp_15" />
</RelativeLayout>
<TextView
style="@style/line"
/>
<RelativeLayout
android:id="@+id/rl_time"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:background="@color/cl_white"
android:onClick="@{()->presenter.selectTime(tvDay.getText().toString())}"
>
android:onClick="@{()->presenter.selectTime()}">
<TextView
android:id="@+id/text_time"
......@@ -105,8 +93,7 @@
android:layout_marginLeft="@dimen/dp_13.3"
android:text="@string/tv_time_text_time_time"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15"
/>
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tv_time"
......@@ -116,26 +103,22 @@
android:layout_marginLeft="@dimen/dp_21.3"
android:layout_toRightOf="@id/text_time"
android:hint="@string/tv_home_tab_updata_subscribe_time_two"
android:text="@={presenter.mHour}"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15"
/>
android:textSize="@dimen/sp_15" />
</RelativeLayout>
<TextView
style="@style/line"
/>
<TextView style="@style/line" />
<TextView
style="@style/line"
android:layout_below="@id/rl_day"
/>
android:layout_below="@id/rl_day" />
<RelativeLayout
android:id="@+id/time_Three"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_183"
android:background="@color/cl_white"
>
android:background="@color/cl_white">
<TextView
android:id="@+id/time_subscribe_remark"
......@@ -145,8 +128,7 @@
android:layout_marginTop="@dimen/dp_27"
android:text="@string/tv_time_text_subscribe_remark"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15"
/>
android:textSize="@dimen/sp_15" />
<EditText
android:id="@+id/et_info"
......@@ -162,8 +144,9 @@
android:maxLength="200"
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_11"
android:text="@={presenter.mInfo}"
android:textColor="@color/cl_home_title_text_color"
android:textColorHint="@color/cl_selector_hui"/>
android:textColorHint="@color/cl_selector_hui" />
</RelativeLayout>
</LinearLayout>
......@@ -179,7 +162,6 @@
android:onClick="@{()->presenter.subcribeTime()}"
android:text="@string/tv_time_text_confirm_subscribe"
android:textColor="@color/cl_white"
android:textSize="@dimen/size_login_button_text"
/>
android:textSize="@dimen/size_login_button_text" />
</RelativeLayout>
</layout>
\ No newline at end of file
......@@ -3,43 +3,37 @@
<data>
<import type="com.dayu.bigfish.presenter.Withdrawals.WithdrawalsPresenter"/>
<variable
name="presenter"
type="WithdrawalsPresenter"/>
type="com.dayu.bigfish.presenter.Withdrawals.WithdrawalsPresenter" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cl_home_listview_bg"
android:orientation="vertical"
>
android:orientation="vertical">
<RelativeLayout
android:id="@+id/time_title"
style="@style/title"
>
style="@style/title">
<TextView
android:id="@+id/title_text"
style="@style/text_title"
android:text="@string/title_withdrawals"
/>
android:text="@string/title_withdrawals" />
<ImageView
android:id="@+id/iv_back"
style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}"
/>
android:onClick="@{()->presenter.dumpBack()}" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape"
/>
android:src="@drawable/line_shape" />
</RelativeLayout>
<LinearLayout
......@@ -52,8 +46,7 @@
android:layout_width="match_parent"
android:layout_height="54dp"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
......@@ -61,8 +54,7 @@
android:layout_marginLeft="@dimen/dp_13.3"
android:text="@string/alipay_account"
android:textColor="#3a3a3a"
android:textSize="14.7sp"
/>
android:textSize="14.7sp" />
<EditText
android:id="@+id/et_accout"
......@@ -71,21 +63,10 @@
android:layout_marginLeft="21.3dp"
android:background="@null"
android:hint="@string/input_alipay_account"
android:text="@={presenter.mAccount}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="14.7sp"
/>
<!--<TextView-->
<!--android:id="@+id/tv_withdrawals_accout"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="21.3dp"-->
<!--android:layout_marginRight="@dimen/dp_13.3"-->
<!--android:gravity="right"-->
<!--android:textColor="@color/cl_home_title_text_color"-->
<!--android:textSize="14.7sp"-->
<!--android:visibility="gone"-->
<!--/>-->
android:textSize="14.7sp" />
</LinearLayout>
</LinearLayout>
......@@ -100,8 +81,7 @@
android:layout_width="match_parent"
android:layout_height="54dp"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
......@@ -109,8 +89,7 @@
android:layout_marginLeft="@dimen/dp_13.3"
android:text="@string/alipay_name"
android:textColor="#3a3a3a"
android:textSize="14.7sp"
/>
android:textSize="14.7sp" />
<EditText
android:id="@+id/et_name"
......@@ -119,21 +98,10 @@
android:layout_marginLeft="21.3dp"
android:background="@null"
android:hint="@string/input_alipay_name"
android:text="@={presenter.mName}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="14.7sp"
/>
<!--<TextView-->
<!--android:id="@+id/tv_withdrawals_name"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="21.3dp"-->
<!--android:layout_marginRight="@dimen/dp_13.3"-->
<!--android:gravity="right"-->
<!--android:textColor="@color/cl_home_title_text_color"-->
<!--android:textSize="14.7sp"-->
<!--android:visibility="gone"-->
<!--/>-->
android:textSize="14.7sp" />
</LinearLayout>
</LinearLayout>
......@@ -148,8 +116,7 @@
android:layout_width="match_parent"
android:layout_height="54dp"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
......@@ -157,8 +124,7 @@
android:layout_marginLeft="@dimen/dp_13.3"
android:text="@string/alipay_phone"
android:textColor="#3a3a3a"
android:textSize="14.7sp"
/>
android:textSize="14.7sp" />
<EditText
android:id="@+id/et_phone"
......@@ -168,21 +134,10 @@
android:background="@null"
android:hint="@string/input_alipay_phone"
android:inputType="phone"
android:text="@={presenter.mPhone}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="14.7sp"
/>
<!--<TextView-->
<!--android:id="@+id/tv_withdrawals_phone"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="21.3dp"-->
<!--android:layout_marginRight="@dimen/dp_13.3"-->
<!--android:gravity="right"-->
<!--android:textColor="@color/cl_home_title_text_color"-->
<!--android:textSize="14.7sp"-->
<!--android:visibility="gone"-->
<!--/>-->
android:textSize="14.7sp" />
</LinearLayout>
</LinearLayout>
......@@ -193,12 +148,11 @@
android:layout_marginLeft="@dimen/dp_16.7"
android:layout_marginRight="@dimen/dp_16.7"
android:layout_marginTop="33.3dp"
android:background="@drawable/btn_login_selector"
android:background="@{presenter.mState ==0?@drawable/btn_login_selector:@drawable/btn_blue_react}"
android:gravity="center"
android:text="@string/comfirm"
android:onClick="@{()->presenter.comfirm()}"
android:textColor="@color/cl_white"
android:textSize="14.7sp"
/>
android:text="@{presenter.mState ==0?@string/comfirm:@string/modify_alipay_info}"
android:textColor="@{presenter.mState ==0?@color/cl_white:@color/cl_receiving_order_item_data}"
android:textSize="14.7sp" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -4,10 +4,6 @@
<data>
<variable
name="presenter"
type="com.dayu.bigfish.presenter.receivingorder.ReceivingPresenter"/>
<variable
name="item"
type="com.dayu.bigfish.bean.Order"/>
</data>
......
......@@ -11,7 +11,7 @@
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/l_recycle"
setDatas="@{presenter.data}"
dataSours="@{presenter.data}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment