Commit a3352462 by wjg

调整列表金额和详情金额逻辑一致

parent e88d0595
......@@ -19,11 +19,11 @@
<application
android:name=".HLApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/hooloo_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup">
tools:replace="android:allowBackup,android:icon">
<activity
android:name=".view.LauncherActivity"
......
......@@ -13,6 +13,7 @@ import com.umeng.commonsdk.UMConfigure;
import cn.jpush.android.api.JPushInterface;
public class HLApplication extends Application {
public static HLApplication SELF = null;
private static MainData mainData = new MainData();
public static MainData getMainData() {
......@@ -26,6 +27,7 @@ public class HLApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
HLApplication.SELF = this;
UMConfigure.preInit(this, AppConfig.UMENG_APPKEY, AppConfig.UMENG_CHANNEL);
UMConfigure.init(this, AppConfig.UMENG_APPKEY, AppConfig.UMENG_CHANNEL, 0, null);
......@@ -35,7 +37,7 @@ public class HLApplication extends Application {
JPushInterface.init(this);
String registrationId = JPushInterface.getRegistrationID(this);
Log.d(AppConfig.TAG_PUSH, registrationId);
Log.d(AppConfig.TAG_PUSH, "get registrationId:" + registrationId);
if (!StringUtils.isEmpty(registrationId)) {
HttpUtil.postRegistrationId(registrationId, null);
}
......
......@@ -35,7 +35,8 @@ public class PushMessageReceiver extends JPushMessageReceiver {
@Override
public void onMessage(Context context, CustomMessage customMessage) {
Log.e(AppConfig.TAG_PUSH,"[onMessage] " + customMessage);
Log.e(AppConfig.TAG_PUSH, "[onMessage] " + customMessage);
this.showToast("onMessage");
dispatchMsg(customMessage);
}
......@@ -47,12 +48,12 @@ public class PushMessageReceiver extends JPushMessageReceiver {
JSONObject jsonObject = JSON.parseObject(customMessage.message);
String action = jsonObject.getString("action");
if (StringUtils.isEmpty(action)) {
Log.e(AppConfig.TAG_PUSH,"msg action is empty");
Log.e(AppConfig.TAG_PUSH, "msg action is empty");
return;
}
Handler handler = subscribers.get(action);
if (handler == null) {
Log.e(AppConfig.TAG_PUSH,String.format("msg action[%s] subscribers is empty", action));
Log.e(AppConfig.TAG_PUSH, String.format("msg action[%s] subscribers is empty", action));
return;
}
JSONObject data = jsonObject.getJSONObject("data");
......@@ -62,54 +63,72 @@ public class PushMessageReceiver extends JPushMessageReceiver {
@Override
public void onNotifyMessageOpened(Context context, NotificationMessage message) {
Log.e(AppConfig.TAG_PUSH,"[onNotifyMessageOpened] " + message);
Log.e(AppConfig.TAG_PUSH, "[onNotifyMessageOpened] " + message);
this.showToast("onNotifyMessageOpened");
}
@Override
public void onMultiActionClicked(Context context, Intent intent) {
Log.e(AppConfig.TAG_PUSH,"[onMultiActionClicked] 用户点击了通知栏按钮");
Log.e(AppConfig.TAG_PUSH, "[onMultiActionClicked] 用户点击了通知栏按钮");
this.showToast("onMultiActionClicked");
String nActionExtra = intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA);
//开发者根据不同 Action 携带的 extra 字段来分配不同的动作。
if (nActionExtra == null) {
Log.d(AppConfig.TAG_PUSH,"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null");
Log.d(AppConfig.TAG_PUSH, "ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null");
return;
}
if (nActionExtra.equals("my_extra1")) {
Log.e(AppConfig.TAG_PUSH,"[onMultiActionClicked] 用户点击通知栏按钮一");
Log.e(AppConfig.TAG_PUSH, "[onMultiActionClicked] 用户点击通知栏按钮一");
} else if (nActionExtra.equals("my_extra2")) {
Log.e(AppConfig.TAG_PUSH,"[onMultiActionClicked] 用户点击通知栏按钮二");
Log.e(AppConfig.TAG_PUSH, "[onMultiActionClicked] 用户点击通知栏按钮二");
} else if (nActionExtra.equals("my_extra3")) {
Log.e(AppConfig.TAG_PUSH,"[onMultiActionClicked] 用户点击通知栏按钮三");
Log.e(AppConfig.TAG_PUSH, "[onMultiActionClicked] 用户点击通知栏按钮三");
} else {
Log.e(AppConfig.TAG_PUSH,"[onMultiActionClicked] 用户点击通知栏按钮未定义");
Log.e(AppConfig.TAG_PUSH, "[onMultiActionClicked] 用户点击通知栏按钮未定义");
}
}
@Override
public void onNotifyMessageArrived(Context context, NotificationMessage message) {
Log.e(AppConfig.TAG_PUSH,"[onNotifyMessageArrived] " + message);
Log.e(AppConfig.TAG_PUSH, "[onNotifyMessageArrived] " + message);
this.showToast("onNotifyMessageArrived");
}
@Override
public void onNotifyMessageDismiss(Context context, NotificationMessage message) {
Log.e(AppConfig.TAG_PUSH,"[onNotifyMessageDismiss] " + message);
Log.e(AppConfig.TAG_PUSH, "[onNotifyMessageDismiss] " + message);
this.showToast("onNotifyMessageDismiss");
}
@Override
public void onRegister(Context context, String registrationId) {
Log.e(AppConfig.TAG_PUSH,"[onRegister] " + registrationId);
Log.e(AppConfig.TAG_PUSH, "[onRegister] " + registrationId);
HttpUtil.postRegistrationId(registrationId, null);
this.showToast("onRegister");
}
@Override
public void onConnected(Context context, boolean isConnected) {
Log.e(AppConfig.TAG_PUSH,"[onConnected] " + isConnected);
Log.e(AppConfig.TAG_PUSH, "[onConnected] " + isConnected);
this.showToast("onConnected");
}
@Override
public void onCommandResult(Context context, CmdMessage cmdMessage) {
Log.e(AppConfig.TAG_PUSH,"[onCommandResult] " + cmdMessage);
Log.e(AppConfig.TAG_PUSH, "[onCommandResult] " + cmdMessage);
this.showToast("onCommandResult");
}
@Override
public void onNotificationSettingsCheck(Context context, boolean isOn, int source) {
super.onNotificationSettingsCheck(context, isOn, source);
Log.e(AppConfig.TAG_PUSH, "[onNotificationSettingsCheck] isOn:" + isOn + ",source:" + source);
this.showToast("onNotificationSettingsCheck");
}
private void showToast(String content) {
// Toast.makeText(HLApplication.SELF, content, Toast.LENGTH_SHORT).show();
}
@Override
......@@ -135,10 +154,4 @@ public class PushMessageReceiver extends JPushMessageReceiver {
// TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage);
super.onMobileNumberOperatorResult(context, jPushMessage);
}
@Override
public void onNotificationSettingsCheck(Context context, boolean isOn, int source) {
super.onNotificationSettingsCheck(context, isOn, source);
Log.e(AppConfig.TAG_PUSH,"[onNotificationSettingsCheck] isOn:" + isOn + ",source:" + source);
}
}
......@@ -133,7 +133,7 @@ public class Utils {
}
public static String toString(BigDecimal num) {
DecimalFormat df = new DecimalFormat("#.00");
DecimalFormat df = new DecimalFormat("0.00");
return df.format(num);
}
......
......@@ -104,7 +104,7 @@ public class MenuPresentation extends Presentation {
Utils.getGlide(getContext()).load(mainData.getImages().getLeft()).into(imgLeft);
}
if (mainData.getShopState().equals(0)) {
if (mainData.getShopState().equals(Base.FALSE)) {
Utils.getGlide(getContext()).load(getRightImage(ImageState.CLOSED.getCode())).into(imgRight);
} else if (!CollectionUtils.isEmpty(cookingOrders)) {
Utils.getGlide(getContext()).load(getRightImage(ImageState.COOKING.getCode())).into(imgRight);
......@@ -236,23 +236,40 @@ public class MenuPresentation extends Presentation {
return;
}
// 添加新订单状态
pkgs.forEach(pkg -> {
if (!pkg.getState().equals(order.getState())) {
return;
}
OrderPkg pkg = getOrdersByState(pkgs, order.getState());
if (pkg == null) {
List<Order> orders = new ArrayList<>();
orders.add(order);
pkg = new OrderPkg();
pkg.setState(order.getState());
pkg.setOrders(orders);
pkgs.add(pkg);
} else {
List<Order> orders = pkg.getOrders();
if (CollectionUtils.isEmpty(orders)) {
orders = new ArrayList<>();
}
orders.add(order);
pkg.setOrders(orders);
});
}
orderDataChanged();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
orderDataChanged();
}
}
}
private OrderPkg getOrdersByState(List<OrderPkg> pkgs, Integer state) {
if (CollectionUtils.isEmpty(pkgs)) {
return null;
}
for (OrderPkg pkg : pkgs) {
if (pkg.getState().equals(state)) {
return pkg;
}
}
return null;
}
}
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 to comment