package com.driver.igotrip.base;
|
|
import android.content.Context;
|
import android.content.Intent;
|
import android.os.Handler;
|
|
import com.driver.igotrip.ui.main.CancelOrderFragment;
|
import com.driver.igotrip.ui.main.DriverPayFragment;
|
import com.driver.igotrip.ui.main.ForceOfflineFragment;
|
import com.driver.igotrip.ui.main.GetOrderFragment;
|
import com.driver.igotrip.ui.main.GoOrderTipsFragment;
|
import com.driver.igotrip.ui.main.ModifyAddressFragment;
|
import com.driver.igotrip.ui.main.TimeOutCancelOrderFragment;
|
import com.driver.igotrip.ui.main.TipsFragment;
|
import com.driver.igotrip.ui.main.TripActivity;
|
import com.driver.igotrip.utils.LanguageManager;
|
|
import cn.sinata.xldutils.activitys.BaseActivity;
|
|
public class PublicServiceActivity extends BaseActivity {
|
|
/***
|
* type 1:普通单 2:该派单
|
* @param orderId
|
* @param orderType
|
* @param time
|
* @param type
|
*/
|
public void showOrder(String audioUrl, String orderId, String orderType, int time, int type) {
|
new Handler(getMainLooper()).post(() -> {
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), GetOrderFragment.class);
|
intent.putExtra("audioUrl", audioUrl);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("orderType", orderType);
|
intent.putExtra("time", time);
|
intent.putExtra("type", type);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
@Override
|
protected void attachBaseContext(Context newBase) {
|
super.attachBaseContext(LanguageManager.wrapContext(newBase));
|
}
|
|
/**
|
* 取消订单
|
*
|
* @param orderId
|
* @param orderType
|
* @param cancelReason
|
* @param cancelPayMoney
|
*/
|
public void cancelOrder(String audioUrl, String orderId, String orderType, String cancelReason, String cancelPayMoney) {
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), CancelOrderFragment.class);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("orderType", orderType);
|
intent.putExtra("cancelReason", cancelReason);
|
intent.putExtra("cancelPayMoney", cancelPayMoney);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
/**
|
* 取消订单
|
*
|
* @param orderId
|
* @param orderType
|
* @param timeOut
|
* @param cancelPayMoney
|
*/
|
public void cancelOrder(String cancelBy, String audioUrl, String orderId, String orderType, Long timeOut, String cancelPayMoney) {
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), TimeOutCancelOrderFragment.class);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("cancelBy", cancelBy);
|
intent.putExtra("orderType", orderType);
|
intent.putExtra("timeOut", timeOut);
|
intent.putExtra("cancelPayMoney", cancelPayMoney);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
/**
|
* 取消待支付
|
*
|
* @param cancelPayMoney
|
*/
|
public void cancelOrder(String audioUrl, String cancelPayMoney) {
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), TimeOutCancelOrderFragment.class);
|
intent.putExtra("cancelPayMoney", cancelPayMoney);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
/**
|
* 修改目的地
|
*
|
* @param orderId
|
* @param orderType
|
*/
|
public void modifyAddress(String audioUrl, String orderId, String orderType) {
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), ModifyAddressFragment.class);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("orderType", orderType);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
/**
|
* 强制下线提示
|
*/
|
public void forceOffline(String audioUrl, String msg) {
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), ForceOfflineFragment.class);
|
intent.putExtra("tips", msg);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
public void onlyTips(String audioUrl, String tips) {
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), TipsFragment.class);
|
intent.putExtra("tips", tips);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
public void goOrderTips(String orderId, String orderType, String audioUrl, String describe) {
|
// MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
boolean needGoOrder = !this.getClass().getName().equals("com.driver.igotrip.ui.main.TripActivity");
|
new Handler(getMainLooper()).post(() -> {
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), GoOrderTipsFragment.class);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("orderType", orderType);
|
intent.putExtra("describe", describe);
|
intent.putExtra("needGoOrder", needGoOrder);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
public void showDriverPayDialog(String audioUrl, String orderId, String orderType, double money) {
|
new Handler(getMainLooper()).post(() -> {
|
// DialogUtil.INSTANCE.getDelAndSureDialog(this, getString(R.string.支付), getString(R.string.关闭),
|
// getString(R.string.您有一笔待支付的订单), () -> null, () -> {
|
// if (this instanceof OrderOverActivity){
|
// finish();
|
// }
|
// Intent intent = new Intent(MyBaseActivity.this, OrderOverActivity.class);
|
// intent.putExtra("orderId", orderId);
|
// intent.putExtra("orderType", orderType);
|
// startActivity(intent);
|
// return null;
|
// });
|
MyApplication.Companion.getTTsManager().setVideoText(audioUrl);
|
Intent intent = new Intent(MyApplication.Companion.getInstance(), DriverPayFragment.class);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("orderType", orderType);
|
intent.putExtra("money", money);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
MyApplication.Companion.getInstance().startActivity(intent);
|
});
|
}
|
|
/***
|
* 扫码
|
* @param orderId
|
* @param orderType
|
*/
|
public void toDorderAct(String orderId, String orderType) {
|
Intent intent = new Intent(this, TripActivity.class);
|
intent.putExtra("orderId", orderId);
|
intent.putExtra("orderType", orderType);
|
startActivity(intent);
|
}
|
|
/***
|
* 跨城
|
* @param orderId
|
* @param orderType
|
*/
|
public void toDorderActCity(String orderId, String orderType) {
|
|
}
|
|
}
|