Commit a3352462 by wjg

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

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