Commit e85544c8 by 罗翻

mactivity.finish替换为mview.dumpback

parent 0765eacd
...@@ -63,7 +63,7 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi ...@@ -63,7 +63,7 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
ProgressUtil.stopLoad(); ProgressUtil.stopLoad();
} }
public void dumbBack() { public void dumpBack() {
mActivity.finish(); mActivity.finish();
} }
......
...@@ -40,6 +40,10 @@ public abstract class BaseFragment<P extends BasePresenter, B extends ViewDataBi ...@@ -40,6 +40,10 @@ public abstract class BaseFragment<P extends BasePresenter, B extends ViewDataBi
if (mPresenter != null) mPresenter.onDetached(); if (mPresenter != null) mPresenter.onDetached();
} }
public void dumpBack() {
mActivity.finish();
}
public void showToast(int resId) { public void showToast(int resId) {
ToastUtils.showShortToast(resId); ToastUtils.showShortToast(resId);
} }
......
...@@ -163,7 +163,7 @@ public abstract class BasePresenter<V> { ...@@ -163,7 +163,7 @@ public abstract class BasePresenter<V> {
public void dumpBack() { public void dumpBack() {
if (mView instanceof BaseActivity) { if (mView instanceof BaseActivity) {
((BaseActivity) mView).dumbBack(); ((BaseActivity) mView).dumpBack();
} }
} }
} }
...@@ -17,6 +17,8 @@ public interface BaseView { ...@@ -17,6 +17,8 @@ public interface BaseView {
void hideDialog(); void hideDialog();
void dumpBack();
void startActivity(Class cls); void startActivity(Class cls);
void startActivity(Class<?> clz, Bundle bundle); void startActivity(Class<?> clz, Bundle bundle);
......
...@@ -60,7 +60,7 @@ public class WithdrawalsPresenter extends WithdrawalsContract.Presenter { ...@@ -60,7 +60,7 @@ public class WithdrawalsPresenter extends WithdrawalsContract.Presenter {
@Override @Override
public void accept(Boolean aBoolean) throws Exception { public void accept(Boolean aBoolean) throws Exception {
mView.showToast(R.string.comfirm_alipay_account_success); mView.showToast(R.string.comfirm_alipay_account_success);
mActivity.finish(); mView.dumpBack();
} }
})); }));
} }
...@@ -71,7 +71,7 @@ public class WithdrawalsPresenter extends WithdrawalsContract.Presenter { ...@@ -71,7 +71,7 @@ public class WithdrawalsPresenter extends WithdrawalsContract.Presenter {
@Override @Override
public void accept(Boolean aBoolean) throws Exception { public void accept(Boolean aBoolean) throws Exception {
mView.showToast(R.string.modify_alipay_account_success); mView.showToast(R.string.modify_alipay_account_success);
mActivity.finish(); mView.dumpBack();
} }
})); }));
} }
......
...@@ -10,7 +10,6 @@ import com.dayu.bigfish.base.BaseView; ...@@ -10,7 +10,6 @@ import com.dayu.bigfish.base.BaseView;
public interface AccountBalanceContract { public interface AccountBalanceContract {
interface View extends BaseView { interface View extends BaseView {
} }
abstract class Presenter extends BaseListPresenter<View> { abstract class Presenter extends BaseListPresenter<View> {
......
package com.dayu.bigfish.presenter.accountbalance; package com.dayu.bigfish.presenter.accountbalance;
import android.content.Intent;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import com.app.annotation.apt.InstanceFactory; import com.app.annotation.apt.InstanceFactory;
...@@ -62,7 +61,6 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter { ...@@ -62,7 +61,6 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter {
@Override @Override
public void dumpToWithdrawal() { public void dumpToWithdrawal() {
Intent intent = new Intent(mActivity, WithdrawalsActivity.class); mView.startActivity(WithdrawalsActivity.class);
mActivity.startActivity(intent);
} }
} }
...@@ -58,7 +58,7 @@ public class FeedBackPresenter extends FeedBackContract.Presenter { ...@@ -58,7 +58,7 @@ public class FeedBackPresenter extends FeedBackContract.Presenter {
@Override @Override
public void accept(Boolean aBoolean) throws Exception { public void accept(Boolean aBoolean) throws Exception {
mView.showToast(R.string.commite_success); mView.showToast(R.string.commite_success);
mActivity.finish(); mView.dumpBack();
} }
})); }));
} }
......
...@@ -55,8 +55,8 @@ public class MainPresenter extends MainContract.Presenter { ...@@ -55,8 +55,8 @@ public class MainPresenter extends MainContract.Presenter {
} }
private void request() { private void request() {
commitVersionInfo(mAccountId, AppUtils.getIMEI(mActivity), "2", AppUtils.getPackageNum(mActivity)); commitVersionInfo(mAccountId, AppUtils.getIMEI(), "2", AppUtils.getPackageNum());
getNewVersion(AppUtils.getPackageNum(mActivity)); getNewVersion(AppUtils.getPackageNum());
getReceiveOrder(Constants.WATING_ORDER, mAccountId, mSiteId, 1, 20); getReceiveOrder(Constants.WATING_ORDER, mAccountId, mSiteId, 1, 20);
getHxNum(mUser.getHxAccount()); getHxNum(mUser.getHxAccount());
} }
...@@ -86,7 +86,7 @@ public class MainPresenter extends MainContract.Presenter { ...@@ -86,7 +86,7 @@ public class MainPresenter extends MainContract.Presenter {
@Override @Override
public void commitVersionInfo(int accoutId, String imei, String platform, String versionCode) { public void commitVersionInfo(int accoutId, String imei, String platform, String versionCode) {
if (SPUtils.get(Constants.OLD_PAKAGENUM, "").equals(mActivity.getPackageName())) { if (SPUtils.get(Constants.OLD_PAKAGENUM, "").equals(MyApplication.getAppContext().getPackageName())) {
return; return;
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
...@@ -102,7 +102,7 @@ public class MainPresenter extends MainContract.Presenter { ...@@ -102,7 +102,7 @@ public class MainPresenter extends MainContract.Presenter {
ApiFactory.commitVersionInfo(requestBody).subscribe(baseObserver(new Consumer<Boolean>() { ApiFactory.commitVersionInfo(requestBody).subscribe(baseObserver(new Consumer<Boolean>() {
@Override @Override
public void accept(Boolean aBoolean) throws Exception { public void accept(Boolean aBoolean) throws Exception {
SPUtils.put(Constants.OLD_PAKAGENUM, mActivity.getPackageName()); SPUtils.put(Constants.OLD_PAKAGENUM, MyApplication.getAppContext().getPackageName());
} }
})); }));
} }
...@@ -164,7 +164,7 @@ public class MainPresenter extends MainContract.Presenter { ...@@ -164,7 +164,7 @@ public class MainPresenter extends MainContract.Presenter {
MobclickAgent.onEvent(MyApplication.getContext(), "sure_update_app"); MobclickAgent.onEvent(MyApplication.getContext(), "sure_update_app");
} else { } else {
if (info.getType() == 2) { if (info.getType() == 2) {
mActivity.finish(); mView.dumpBack();
} }
MobclickAgent.onEvent(MyApplication.getContext(), "cancle_update_app"); MobclickAgent.onEvent(MyApplication.getContext(), "cancle_update_app");
} }
......
...@@ -9,6 +9,7 @@ import android.text.TextUtils; ...@@ -9,6 +9,7 @@ import android.text.TextUtils;
import com.app.annotation.apt.InstanceFactory; import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory; import com.apt.ApiFactory;
import com.dayu.bigfish.Constants; import com.dayu.bigfish.Constants;
import com.dayu.bigfish.MyApplication;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.bean.OrderDetail; import com.dayu.bigfish.bean.OrderDetail;
import com.dayu.bigfish.bean.UserInfo; import com.dayu.bigfish.bean.UserInfo;
...@@ -100,7 +101,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter { ...@@ -100,7 +101,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
mOrderField.get().setOtherPrice(""); mOrderField.get().setOtherPrice("");
mOrderField.get().setOtherInfo(""); mOrderField.get().setOtherInfo("");
} }
MobclickAgent.onEvent(mActivity, "get_customer_money"); MobclickAgent.onEvent(MyApplication.getContext(), "get_customer_money");
} }
@Override @Override
...@@ -160,7 +161,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter { ...@@ -160,7 +161,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
EventBus.getDefault().post(new OrderState(status, mPosition)); EventBus.getDefault().post(new OrderState(status, mPosition));
mOrderInfoDao.deleteByKey((long) orderId); mOrderInfoDao.deleteByKey((long) orderId);
PictureFileUtils.deleteCacheDirFile(mActivity); PictureFileUtils.deleteCacheDirFile(mActivity);
mActivity.finish(); mView.dumpBack();
} }
})); }));
} }
......
...@@ -82,7 +82,7 @@ public class ReceivingPresenter extends ReceivingContract.Presenter { ...@@ -82,7 +82,7 @@ public class ReceivingPresenter extends ReceivingContract.Presenter {
int num = mTotalRows - 1; int num = mTotalRows - 1;
mView.showToast(R.string.receive_order_success); mView.showToast(R.string.receive_order_success);
EventBus.getDefault().post(new SwtichFragment(1)); EventBus.getDefault().post(new SwtichFragment(1));
mActivity.finish(); mView.dumpBack();
mDisPosable = Observable.timer(300, TimeUnit.MILLISECONDS).subscribe(aLong -> { mDisPosable = Observable.timer(300, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshTab(0)); EventBus.getDefault().post(new RefreshTab(0));
EventBus.getDefault().post(new RefreshReceivingNum(num < 0 ? 0 : num)); EventBus.getDefault().post(new RefreshReceivingNum(num < 0 ? 0 : num));
......
...@@ -10,6 +10,7 @@ import android.text.TextUtils; ...@@ -10,6 +10,7 @@ import android.text.TextUtils;
import com.app.annotation.apt.InstanceFactory; import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory; import com.apt.ApiFactory;
import com.dayu.bigfish.Constants; import com.dayu.bigfish.Constants;
import com.dayu.bigfish.MyApplication;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.bean.UserInfo; import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.ui.AboutUsActivity; import com.dayu.bigfish.ui.AboutUsActivity;
...@@ -72,7 +73,7 @@ public class SettingPresenter extends SettingContract.Presenter { ...@@ -72,7 +73,7 @@ public class SettingPresenter extends SettingContract.Presenter {
} else { } else {
EMClient.getInstance().logout(true); EMClient.getInstance().logout(true);
} }
MobclickAgent.onEvent(mActivity, "swtich_message_button"); MobclickAgent.onEvent(MyApplication.getContext(), "swtich_message_button");
} }
...@@ -81,7 +82,7 @@ public class SettingPresenter extends SettingContract.Presenter { ...@@ -81,7 +82,7 @@ public class SettingPresenter extends SettingContract.Presenter {
ApiFactory.checkVersion("dayushifua_dayu").subscribe(baseObserver(new Consumer<String>() { ApiFactory.checkVersion("dayushifua_dayu").subscribe(baseObserver(new Consumer<String>() {
@Override @Override
public void accept(String s) throws Exception { public void accept(String s) throws Exception {
if (s.equals(AppUtils.getPackageNum(mActivity))) { if (s.equals(AppUtils.getPackageNum())) {
mView.showToast(R.string.is_newversion); mView.showToast(R.string.is_newversion);
} else { } else {
mView.showToast(mActivity.getString(R.string.newversion_code) + s); mView.showToast(mActivity.getString(R.string.newversion_code) + s);
......
...@@ -102,7 +102,7 @@ public class SubcribeTimePresenter extends SubcribeContract.Presenter { ...@@ -102,7 +102,7 @@ public class SubcribeTimePresenter extends SubcribeContract.Presenter {
} else if (mState == ORDER_YUYUE || mState == ORDER_DOING) { } else if (mState == ORDER_YUYUE || mState == ORDER_DOING) {
EventBus.getDefault().post(new OrderState(ORDER_YUYUE, mPosition, mTime)); EventBus.getDefault().post(new OrderState(ORDER_YUYUE, mPosition, mTime));
} }
mActivity.finish(); mView.dumpBack();
} }
}, responeThrowable -> { }, responeThrowable -> {
if ("ORDER0004".equals(responeThrowable.subCode)) { if ("ORDER0004".equals(responeThrowable.subCode)) {
...@@ -113,7 +113,7 @@ public class SubcribeTimePresenter extends SubcribeContract.Presenter { ...@@ -113,7 +113,7 @@ public class SubcribeTimePresenter extends SubcribeContract.Presenter {
EventBus.getDefault().post(new RefreshTab(3)); EventBus.getDefault().post(new RefreshTab(3));
EventBus.getDefault().post(new RefreshServe(1)); EventBus.getDefault().post(new RefreshServe(1));
} }
mActivity.finish(); mView.dumpBack();
} }
})); }));
} }
......
package com.dayu.bigfish.utils; package com.dayu.bigfish.utils;
import android.content.Context;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import com.dayu.bigfish.MyApplication;
/** /**
* Created by luofan on 2017/11/7. * Created by luofan on 2017/11/7.
*/ */
public class AppUtils { public class AppUtils {
public static final int REQUEST_PHONE_STATE_PERMISSION = 0;
/** /**
* 获取设备IMEI编号 * 获取设备IMEI编号
*/ */
public static String getIMEI(Context context) { public static String getIMEI() {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE); TelephonyManager telephonyManager = (TelephonyManager) MyApplication.getAppContext().getSystemService(MyApplication.getAppContext().TELEPHONY_SERVICE);
String imei = telephonyManager.getDeviceId(); String imei = telephonyManager.getDeviceId();
return imei; return imei;
...@@ -28,9 +27,9 @@ public class AppUtils { ...@@ -28,9 +27,9 @@ public class AppUtils {
/** /**
* 获取当前应用的版本号 * 获取当前应用的版本号
*/ */
public static String getPackageNum(Context context) { public static String getPackageNum() {
try { try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); PackageInfo packageInfo = MyApplication.getAppContext().getPackageManager().getPackageInfo(MyApplication.getAppContext().getPackageName(), 0);
String packageName = packageInfo.versionName; String packageName = packageInfo.versionName;
return packageName; return packageName;
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
......
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