Procházet zdrojové kódy

Merge branch 'feature' of https://gitlab.com/Arisono/SkWeiChat-Baidu into feature_arison

# Conflicts:
#	WeiChat/version.properties
Arison před 8 roky
rodič
revize
a3dadadadb
39 změnil soubory, kde provedl 2139 přidání a 84 odebrání
  1. 3 3
      WeiChat/version.properties
  2. 6 5
      app_core/common/src/main/java/com/common/LogUtil.java
  3. 32 0
      app_core/common/src/main/java/com/core/widget/PinnedSectionListView.java
  4. 5 1
      app_modular/appbooking/build.gradle
  5. 161 19
      app_modular/appbooking/src/main/java/com/modular/booking/activity/services/DishSelectActivity.java
  6. 184 0
      app_modular/appbooking/src/main/java/com/modular/booking/activity/utils/ShoppingCart.java
  7. 90 0
      app_modular/appbooking/src/main/java/com/modular/booking/activity/utils/ShoppingCartPanel.java
  8. 29 4
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishCategoryListAdapter.java
  9. 89 8
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishPinnedListAdapter.java
  10. 108 0
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/LayoutShoppingCartItemAdapter.java
  11. 30 0
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/ShoppingCartListAdapter.java
  12. 65 0
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/holder/ShoppingCartItemViewHolder.java
  13. 105 0
      app_modular/appbooking/src/main/java/com/modular/booking/base/BaseAdapter.java
  14. 25 0
      app_modular/appbooking/src/main/java/com/modular/booking/base/IAdapter.java
  15. 13 0
      app_modular/appbooking/src/main/java/com/modular/booking/base/IViewHolder.java
  16. 22 0
      app_modular/appbooking/src/main/java/com/modular/booking/model/Product.java
  17. 26 2
      app_modular/appbooking/src/main/java/com/modular/booking/model/ProductCategory.java
  18. 121 0
      app_modular/appbooking/src/main/java/com/modular/booking/model/ShoppingEntity.java
  19. 21 0
      app_modular/appbooking/src/main/java/com/modular/booking/utils/EventMessage.java
  20. 39 0
      app_modular/appbooking/src/main/java/com/modular/booking/utils/RxBus.java
  21. 7 0
      app_modular/appbooking/src/main/java/com/modular/booking/utils/ViewEventListener.java
  22. 646 0
      app_modular/appbooking/src/main/java/com/modular/booking/widget/ShoppingCountView.java
  23. binární
      app_modular/appbooking/src/main/res/drawable-mdpi/icon_dish_shopcart_clear.png
  24. binární
      app_modular/appbooking/src/main/res/drawable-xhdpi/icon_dish_shopcart_clear.png
  25. binární
      app_modular/appbooking/src/main/res/drawable-xxhdpi/icon_dish_shopcart_clear.png
  26. 6 0
      app_modular/appbooking/src/main/res/drawable/selector_dish_menu.xml
  27. 1 2
      app_modular/appbooking/src/main/res/layout/activity_bservice_add.xml
  28. 23 32
      app_modular/appbooking/src/main/res/layout/activity_dish_select.xml
  29. 3 4
      app_modular/appbooking/src/main/res/layout/item_dish_catagory_list.xml
  30. 98 0
      app_modular/appbooking/src/main/res/layout/item_dish_list.xml
  31. 44 0
      app_modular/appbooking/src/main/res/layout/item_dish_list_head.xml
  32. 63 0
      app_modular/appbooking/src/main/res/layout/layout_shopping_cart_item.xml
  33. 52 0
      app_modular/appbooking/src/main/res/layout/layout_shopping_cart_panel.xml
  34. 1 0
      app_modular/appbooking/src/main/res/values-en/strings.xml
  35. 1 0
      app_modular/appbooking/src/main/res/values-zh-rCN/strings.xml
  36. 1 0
      app_modular/appbooking/src/main/res/values-zh-rTW/strings.xml
  37. 6 0
      app_modular/appbooking/src/main/res/values/strings.xml
  38. 11 2
      app_modular/appbooking/src/main/res/values/styles.xml
  39. 2 2
      app_modular/apputils/src/main/java/com/modular/apputils/activity/SimpleWebActivity.java

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Mon Jan 29 09:20:35 CST 2018
-debugName=179
+#Thu Feb 01 17:30:43 CST 2018
+debugName=325
 versionName=613
-debugCode=179
+debugCode=325
 versionCode=152

+ 6 - 5
app_core/common/src/main/java/com/common/LogUtil.java

@@ -95,16 +95,17 @@ public class LogUtil {
 	}
 
 	public static void prinlnLongMsg(String TAG, String responseInfo) {
+		int maxLenght=3000;
 		if (responseInfo != null) {
-			if (responseInfo.length() >=4000) {
+			if (responseInfo.length() >= maxLenght) {
 				Log.v(TAG, "sb.length = " + responseInfo.length());
-				int chunkCount = responseInfo.length() / 4000;     // integer division
+				int chunkCount = responseInfo.length() /  maxLenght;     // integer division
 				for (int i = 0; i <= chunkCount; i++) {
-					int max = 4000 * (i + 1);
+					int max =  maxLenght * (i + 1);
 					if (max >= responseInfo.length()) {
-						Log.d(TAG, "【"+ i + "】" + responseInfo.substring(4000 * i));
+						Log.d(TAG, "+log" + responseInfo.substring( maxLenght * i));
 					} else {
-						Log.d(TAG, "【" + i+ "】" + responseInfo.substring(4000 * i, max));
+						Log.d(TAG, "+log" + responseInfo.substring( maxLenght * i, max));
 					}
 				}
 			} else {

+ 32 - 0
app_core/common/src/main/java/com/core/widget/PinnedSectionListView.java

@@ -26,6 +26,7 @@ import android.graphics.drawable.GradientDrawable;
 import android.graphics.drawable.GradientDrawable.Orientation;
 import android.os.Parcelable;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.MotionEvent;
 import android.view.SoundEffectConstants;
 import android.view.View;
@@ -458,4 +459,35 @@ public class PinnedSectionListView extends ListView {
 		}
 		return ((PinnedSectionListAdapter) adapter).isItemViewTypePinned(viewType);
 	}
+
+	@Override
+	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+		/**@注释:这两个代码是用在嵌套scrollview控件中的,解决显示一行的问题,但是会产生新的问题  */
+//        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
+//                MeasureSpec.AT_MOST);
+//        super.onMeasure(widthMeasureSpec, expandSpec);
+		int height = getMeasuredHeight();
+		int width = 0;
+
+		int widthMode = MeasureSpec.getMode(widthMeasureSpec);
+		int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+		if (widthMode == MeasureSpec.EXACTLY) {
+			//设置了精确的宽度,则为精确模式
+			Log.i("ListView", "精确模式");
+			width = widthSize;
+		} else {
+			if (widthMode == MeasureSpec.AT_MOST) {
+				Log.i("ListView", "AT_MOST模式");
+				final int childCount = getChildCount();
+				for (int i = 0; i < childCount; i++) {
+					View view = getChildAt(i);
+					measureChild(view, widthMeasureSpec, heightMeasureSpec);
+					width = Math.max(width, view.getMeasuredWidth());
+					//height =+Math.max(height, view.getMeasuredHeight());
+				}
+			}
+		}
+		setMeasuredDimension(width, height);
+	}
 }

+ 5 - 1
app_modular/appbooking/build.gradle

@@ -1,7 +1,11 @@
 apply plugin: 'com.android.library'
-
+apply plugin: 'me.tatarka.retrolambda'
 
 android {
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
     compileSdkVersion rootProject.ext.android.compileSdkVersion
     buildToolsVersion rootProject.ext.android.buildToolsVersion
     defaultConfig {

+ 161 - 19
app_modular/appbooking/src/main/java/com/modular/booking/activity/services/DishSelectActivity.java

@@ -1,13 +1,17 @@
 package com.modular.booking.activity.services;
 
 import android.os.Bundle;
-import android.widget.ListView;
+import android.view.View;
+import android.widget.AbsListView;
+import android.widget.AdapterView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.common.LogUtil;
 import com.core.base.OABaseActivity;
+import com.core.widget.CustomerListView;
 import com.core.widget.PinnedSectionListView;
 import com.flipboard.bottomsheet.BottomSheetLayout;
 import com.me.network.app.http.HttpClient;
@@ -15,15 +19,21 @@ import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.modular.booking.R;
+import com.modular.booking.activity.utils.ShoppingCart;
+import com.modular.booking.activity.utils.ShoppingCartPanel;
 import com.modular.booking.adapter.ItemDishCategoryListAdapter;
 import com.modular.booking.adapter.ItemDishPinnedListAdapter;
 import com.modular.booking.model.Product;
 import com.modular.booking.model.ProductCategory;
+import com.modular.booking.utils.EventMessage;
+import com.modular.booking.utils.RxBus;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import de.hdodenhof.circleimageview.CircleImageView;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
 
 /**
   * @desc:选择菜品
@@ -31,17 +41,23 @@ import de.hdodenhof.circleimageview.CircleImageView;
   */
 public class DishSelectActivity extends OABaseActivity {
     
-    private static final String TAG = "DishSelectActivity";
+    public static final String TAG = "DishSelectActivity";
     private CircleImageView mCircleImage;
     private TextView tv_title;
     private TextView tv_sub;
     private BottomSheetLayout  mBottmSheetLayout;
-    private ListView lv_product_category;
+    private LinearLayout ll_bottom;
+    private CustomerListView lv_product_category;
     private PinnedSectionListView lv_product;
+
+    private ShoppingCartPanel mShoppingCartPanel;
     
     private List<ProductCategory> productCategories=new ArrayList<>();
+    List<ProductCategory> productAllCategorys=new ArrayList<>();
     private ItemDishCategoryListAdapter itemDishCategoryListAdapter;
     private ItemDishPinnedListAdapter itemDishPinnedListAdapter;
+  
+    
     
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -53,14 +69,92 @@ public class DishSelectActivity extends OABaseActivity {
     }
     
     private void initView(){
+        mShoppingCartPanel = new ShoppingCartPanel(this);
         getSupportActionBar().setTitle("选菜");
         lv_product_category= findViewById(R.id.lv_product_category);
+        mBottmSheetLayout=findViewById(R.id.bottom_sheet_layout);
         lv_product=findViewById(R.id.lv_dish_product);
-        itemDishCategoryListAdapter=new ItemDishCategoryListAdapter(mContext,productCategories);
+        ll_bottom=findViewById(R.id.ll_bottom);
+        itemDishCategoryListAdapter=new ItemDishCategoryListAdapter(DishSelectActivity.this,productCategories);
         lv_product_category.setAdapter( itemDishCategoryListAdapter);
+        lv_product_category.setSelection(0);
+        
+        
+        itemDishPinnedListAdapter=new ItemDishPinnedListAdapter(mContext,productAllCategorys);
+        lv_product.setAdapter(itemDishPinnedListAdapter);
+
+//        lv_product_category.setItemChecked(0,true);
+    }
+    private boolean isClickTrigger=true;
+    private void initEvent(){
+        ll_bottom.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                showShoppingCartPanel();
+            }
+        });
+
+        lv_product_category.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+                ProductCategory category=   itemDishCategoryListAdapter.getItem(i);
+                String name=category.getCode();
+                isClickTrigger = true;
+                for (int j = 0; j <productAllCategorys.size() ; j++) {
+                    if (name.equals(productAllCategorys.get(j).getCode())){
+                        lv_product.setSelection(j);
+                    }
+                }
+                itemDishCategoryListAdapter.setSelectIndex(i);
+                itemDishCategoryListAdapter.notifyDataSetChanged();
+            }
+        });
+
+   
+        lv_product.setOnScrollListener(new AbsListView.OnScrollListener() {
+            @Override
+            public void onScrollStateChanged(AbsListView absListView, int i) {
+
+            }
+
+            @Override
+            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+//                if (isClickTrigger) {
+//                    isClickTrigger = false;
+//                } else {
+                    if (itemDishPinnedListAdapter.getProductCategories().size() > 0) {
+                        if (itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct()!=null){
+                            itemDishCategoryListAdapter.setSelectIndex(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId());
+                           // lv_product_category.setItemChecked(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId(),true);
+                           // lv_product_category.setSelection(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId());
+                          // itemDishCategoryListAdapter.notifyDataSetChanged();
+                        }else{
+                            itemDishCategoryListAdapter.setSelectIndex(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId());
+                           // lv_product_category.setItemChecked(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId(),true);
+                          // lv_product_category.setSelection(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId());
+                          // itemDishCategoryListAdapter.notifyDataSetChanged();
+                        }
+                    }
+//                }
+
+            }
+        });
+        
+//        lv_product.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+//            @Override
+//            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+//
+//            }
+//        });
+
+
+        mSubscription= RxBus.getInstance().toObservable()
+                .filter(o -> o instanceof EventMessage)
+                .map(o -> (EventMessage) o)
+                 .observeOn(AndroidSchedulers.mainThread())
+                .doOnNext(o -> onShoppingCartChange(o.getObject()))
+                .subscribe();
     }
-    
-    private void initEvent(){}
  
     private void initData(){
           HttpClient httpClient=new HttpClient.Builder("http://192.168.253.200:8080/Chapter/").build();
@@ -71,39 +165,87 @@ public class DishSelectActivity extends OABaseActivity {
           
                      @Override
                      public void onResponse(Object o) {
-                         //LogUtil.prinlnLongMsg(TAG,o.toString());
-                         try {
+                       //  LogUtil.d(TAG,o.toString());
+//                         try {
                              String data=   JSON.parseObject(o.toString()).getString("Data");
                              JSONArray dishCategories= JSON.parseObject(data).getJSONArray("DishCategories");
                              JSONArray dishs=JSON.parseObject(data).getJSONArray("Dishs");
-                             
+                         
                              List<ProductCategory> productCategorys= JSON.parseArray(dishCategories.toJSONString(), ProductCategory.class);
+                             productCategories.addAll(productCategorys);
+                             itemDishCategoryListAdapter.notifyDataSetChanged();
+                            
                              List<Product> products= JSON.parseArray(dishs.toJSONString(), Product.class);
+                      
                              for (int i = 0; i < productCategorys.size(); i++) {
                                 // LogUtil.d(TAG,"菜类:"+productCategorys.get(i).getName());
                                  String code=productCategorys.get(i).getCode();  //关联菜单
+                                 String name=productCategorys.get(i).getName();
+                                 productCategorys.get(i).setDishCategoryId(i);
+                                 productAllCategorys.add(productCategorys.get(i));
+                                 //productCategories.add(productCategorys.get(i));
                                  for (int j = 0; j < products.size(); j++) {
                                     // LogUtil.d(TAG,"菜名:"+products.get(j).getDishCategoryCode());
                                      String dishCategoryCode=products.get(j).getDishCategoryCode();
                                      if (code.equals(dishCategoryCode)){
-                                         productCategorys.get(i).getProducts().add(products.get(j));
-                                         productCategorys.get(i).setType(ProductCategory.ITEM);
+                                         //建立分类Item 
+                                         ProductCategory productCategory=new ProductCategory();
+                                         productCategory.setType(ProductCategory.ITEM);
+                                         products.get(j).setDishCategoryName(name);
+                                         products.get(j).setDishCategoryId(i);
+                                         productCategory.setProduct(products.get(j));
+                                         productCategory.setName(products.get(j).getName());
+                                         productAllCategorys.add(productCategory);
+                                        // productCategories.add(productCategory);
+//                                         productCategorys.get(i).getProducts().add(products.get(j));
+//                                         productCategorys.get(i).setType(ProductCategory.ITEM);
                                      }
                                  }
                              }
 
-                             productCategories.addAll(productCategorys);
-                             itemDishCategoryListAdapter.notifyDataSetChanged();
+                        
                              
-                            
-                            LogUtil.prinlnLongMsg(TAG,JSON.toJSONString(productCategorys));
+                            itemDishPinnedListAdapter.notifyDataSetChanged();
+                            LogUtil.prinlnLongMsg(TAG,JSON.toJSONString(productAllCategorys));
                           
-                         } catch (Exception e) {
-                             LogUtil.d(TAG,"发生了异常 e:"+e.toString());
-                             e.printStackTrace();
-                         }
+//                         } catch (Exception e) {
+//                             LogUtil.d(TAG,"发生了异常 e:"+e.toString());
+//                             e.printStackTrace();
+//                         }
                      }
                  }));
     }
+
+
+    /**
+     * 显示购物车面板
+     */
+    private void showShoppingCartPanel() {
+        int count = ShoppingCart.getInstance().getTotalQuantity();
+        if (count > 0 && !mBottmSheetLayout.isSheetShowing()) {
+            mShoppingCartPanel.refreshPanel();
+            mBottmSheetLayout.showWithSheetView(mShoppingCartPanel);
+        } else {
+            mBottmSheetLayout.dismissSheet();
+        }
+    }
     
+    Subscription mSubscription;
+
+    public void onShoppingCartChange(Object o) {
+      //  refreshBottomUi();
+        LogUtil.d(TAG,"o:"+o.toString());
+        mShoppingCartPanel.refreshPanel();
+        itemDishCategoryListAdapter.notifyDataSetChanged();
+       itemDishPinnedListAdapter.notifyDataSetChanged();
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        // 注册 ---被观察者
+        if (mSubscription != null && !mSubscription.isUnsubscribed()) {
+            mSubscription.unsubscribe();
+        }
+    }
 }

+ 184 - 0
app_modular/appbooking/src/main/java/com/modular/booking/activity/utils/ShoppingCart.java

@@ -0,0 +1,184 @@
+package com.modular.booking.activity.utils;
+
+import com.common.LogUtil;
+import com.modular.booking.activity.services.DishSelectActivity;
+import com.modular.booking.model.Product;
+import com.modular.booking.model.ShoppingEntity;
+import com.modular.booking.utils.EventMessage;
+import com.modular.booking.utils.RxBus;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Arison on 2018/1/30.
+ */
+
+public class ShoppingCart {
+    private String mBusinessId;
+    private Map<String, ShoppingEntity> mShoppingList;
+
+    private static ShoppingCart instance;
+
+    public static ShoppingCart getInstance() {
+        if (instance == null) {
+            LogUtil.d("ShopCar","购物车初始化 init()");
+            instance = new ShoppingCart();
+        }
+
+        return instance;
+    }
+
+    private ShoppingCart() {
+        mShoppingList = new HashMap<>();
+    }
+
+    /**
+     * 往购物车内添加商品
+     * @param product 添加的商品对象
+     * @return 是否添加成功
+     */
+    public boolean add(Product product) {
+        String id = product.getCode();
+        if (mShoppingList.isEmpty()) {
+            // 第一次添加需要记录商家ID
+            mBusinessId = product.getBusinessId();
+            // 通过Product对象初始化一个ShoppingEntity对象
+            ShoppingEntity entity = ShoppingEntity.initWithProduct(product);
+            mShoppingList.put(id, entity);
+//            sendChangeEvent();
+//            RxBus.getInstance().send(
+//                    new EventMessage(DishSelectActivity.TAG));
+            return true;
+        } else if (mBusinessId.equals(product.getBusinessId())) {
+            ShoppingEntity entity = mShoppingList.containsKey(id) ? mShoppingList.get(id) : null;
+            if (entity == null) {
+                entity = ShoppingEntity.initWithProduct(product);
+            } else {
+                entity.setQuantity(entity.getQuantity() + 1);
+            }
+            mShoppingList.put(id, entity);
+//            sendChangeEvent();
+//            RxBus.getInstance().send(
+//                    new EventMessage(DishSelectActivity.TAG));
+            return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * 往购物车里减少商品
+     * @param product 需要减少的商品对象
+     * @return 是否减少成功
+     */
+    public boolean delete(Product product) {
+        String id = product.getCode();
+        if (mShoppingList.containsKey(id)) {
+            ShoppingEntity entity = mShoppingList.get(id);
+            int originQuantity = entity.getQuantity();
+            if (originQuantity > 1) {
+                entity.setQuantity(--originQuantity);
+                mShoppingList.put(id, entity);
+//                sendChangeEvent();
+                RxBus.getInstance().send(
+                        new EventMessage(DishSelectActivity.TAG));
+                return true;
+            } else if (originQuantity == 1) {
+                mShoppingList.remove(id);
+//                sendChangeEvent();
+                RxBus.getInstance().send(
+                        new EventMessage(DishSelectActivity.TAG));
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * 往购物车里添加指定数量的商品
+     * @param product 需要添加的商品对象
+     * @return 是否添加成功
+     */
+    public boolean set(Product product, int quantity) {
+
+        return false;
+    }
+
+
+    /**
+     * 清空购物车里的所有数据
+     */
+    public void clearAll() {
+        mShoppingList.clear();
+        RxBus.getInstance().send(
+                new EventMessage(DishSelectActivity.TAG));
+//        sendChangeEvent();
+    }
+
+
+    /**
+     * 获取商家ID
+     * @return 商家ID
+     */
+    public String getBusinessId() {
+        return mBusinessId;
+    }
+
+    /**
+     * 获取购物车里所有商品的总价
+     * @return 商品总价
+     */
+    public double getTotalPrice() {
+        double totalPrice = 0.0d;
+        for (ShoppingEntity entry : mShoppingList.values()) {
+            totalPrice += entry.getTotalPrice();
+        }
+
+        return totalPrice;
+    }
+
+
+    /**
+     * 获取购物车里所有商品的数量
+     * @return 商品数量
+     */
+    public int getTotalQuantity() {
+        int totalQuantity = 0;
+        for (ShoppingEntity entry : mShoppingList.values()) {
+            totalQuantity += entry.getQuantity();
+        }
+
+        return totalQuantity;
+    }
+
+    /**
+     * 获取购物车里指定商品的数量
+     * @param product 指定的商品
+     * @return 商品数量
+     */
+    public int getQuantityForProduct(Product product) {
+        String id = product.getCode();
+        if (mShoppingList.containsKey(id)) {
+            return mShoppingList.get(id).getQuantity();
+        }
+
+        return 0;
+    }
+
+    /**
+     * 获取购物车的选购列表
+     * @return 选购列表
+     */
+    public List<ShoppingEntity> getShoppingList() {
+        List<ShoppingEntity> entities = new ArrayList<>();
+        for (ShoppingEntity entry : mShoppingList.values()) {
+            entities.add(entry);
+        }
+        return entities;
+    }
+
+}

+ 90 - 0
app_modular/appbooking/src/main/java/com/modular/booking/activity/utils/ShoppingCartPanel.java

@@ -0,0 +1,90 @@
+package com.modular.booking.activity.utils;
+
+import android.content.Context;
+import android.content.DialogInterface;
+import android.support.v7.app.AlertDialog;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.alibaba.fastjson.JSON;
+import com.common.LogUtil;
+import com.modular.booking.R;
+import com.modular.booking.adapter.LayoutShoppingCartItemAdapter;
+import com.modular.booking.model.ShoppingEntity;
+
+import java.util.List;
+
+
+/**
+ * 购物车面板
+ */
+public class ShoppingCartPanel extends FrameLayout {
+    
+    TextView mClearTxt;
+//    RecyclerView mRecyclerView;
+     ListView  lv_data;
+
+    private LayoutShoppingCartItemAdapter layoutShoppingCartItemAdapter;
+
+//    private ShoppingCartListAdapter mAdapter;
+
+    public ShoppingCartPanel(Context context) {
+        this(context, null);
+    }
+
+    public ShoppingCartPanel(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        View view = LayoutInflater.from(context).inflate(R.layout.layout_shopping_cart_panel, this);
+        mClearTxt=view.findViewById(R.id.txt_clear);
+//        mRecyclerView=view.findViewById(R.id.recycler_view);
+        lv_data=view.findViewById(R.id.lv_data);
+        mClearTxt.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                clearShoppingCart();
+            }
+        });
+        layoutShoppingCartItemAdapter=new LayoutShoppingCartItemAdapter(context);
+        initViews();
+        refreshPanel();
+    }
+
+    private void initViews() {
+//     mAdapter = new ShoppingCartListAdapter();
+       lv_data.setAdapter(layoutShoppingCartItemAdapter);
+//        mRecyclerView.setAdapter(mAdapter);
+//        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+    }
+
+    public void refreshPanel() {
+        ShoppingCart shoppingCart = ShoppingCart.getInstance();
+        List<ShoppingEntity> entities = shoppingCart.getShoppingList();
+        LogUtil.d("ShopCar", "面板data:"+JSON.toJSONString(entities));
+        layoutShoppingCartItemAdapter.setItems(entities);
+    }
+    
+    /**
+     * 清空购物车
+     */
+    private void clearShoppingCart() {
+        new AlertDialog.Builder(getContext())
+                .setTitle(R.string.dialog_clear_shopping_cart_title)
+                .setMessage(R.string.dialog_clear_shopping_cart_message)
+                .setCancelable(false)
+                .setPositiveButton(R.string.sure, new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        ShoppingCart.getInstance().clearAll();
+//                        mAdapter.clearItems();
+                        
+                    }
+                })
+                .setNegativeButton(R.string.cancel, null)
+                .create()
+                .show();
+    }
+}

+ 29 - 4
app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishCategoryListAdapter.java

@@ -1,10 +1,12 @@
 package com.modular.booking.adapter;
 
 import android.content.Context;
+import android.graphics.Color;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import com.modular.booking.R;
@@ -22,6 +24,7 @@ public class ItemDishCategoryListAdapter extends BaseAdapter {
     private List<ProductCategory> productCategories=new ArrayList<>();
     private Context ct;
     private LayoutInflater layoutInflater;
+    private int selectIndex=0;
     public ItemDishCategoryListAdapter(Context ct,List<ProductCategory> datas){
         this.ct=ct;
         this.productCategories=datas;  
@@ -29,13 +32,21 @@ public class ItemDishCategoryListAdapter extends BaseAdapter {
         
     }
 
+    public int getSelectIndex() {
+        return selectIndex;
+    }
+
+    public void setSelectIndex(int selectIndex) {
+        this.selectIndex = selectIndex;
+    }
+
     @Override
     public int getCount() {
         return productCategories.size();
     }
 
     @Override
-    public Object getItem(int i) {
+    public ProductCategory getItem(int i) {
         return productCategories.get(i);
     }
 
@@ -50,21 +61,35 @@ public class ItemDishCategoryListAdapter extends BaseAdapter {
             convertView = layoutInflater.inflate(R.layout.item_dish_catagory_list, null);
             convertView.setTag(new ViewHolder(convertView));
         }
-        initializeViews((ProductCategory)getItem(position), (ViewHolder) convertView.getTag());
+        initializeViews((ProductCategory)getItem(position), (ViewHolder) convertView.getTag(),position);
+
+        if (position == selectIndex) {
+            convertView.setBackgroundColor(Color.parseColor("#ffffff"));
+        } else {
+            
+            convertView.setBackgroundColor(Color.parseColor("#f3f3f3"));
+        }
         return convertView;
     }
 
-    private void initializeViews(ProductCategory object, ViewHolder holder) {
+    private void initializeViews(ProductCategory object, ViewHolder holder,int position) {
         holder.tvName.setText(object.getName());
+//        if (selectIndex==position){
+//            holder.rlLayout.setSelected(true);
+//        }else{
+//            holder.rlLayout.setSelected(false);
+//        }
         holder.modle=object;
     }
 
     protected class ViewHolder {
         private TextView tvName;
+        private RelativeLayout rlLayout;
         private ProductCategory modle;
 
         public ViewHolder(View view) {
-            tvName = (TextView) view.findViewById(R.id.tv_name);
+            tvName = view.findViewById(R.id.tv_name);
+            rlLayout=view.findViewById(R.id.rl_dish_top);
         }
     }
 }

+ 89 - 8
app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishPinnedListAdapter.java

@@ -1,10 +1,25 @@
 package com.modular.booking.adapter;
 
+import android.content.Context;
+import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
+import com.common.LogUtil;
+import com.core.utils.helper.AvatarHelper;
 import com.core.widget.PinnedSectionListView;
+import com.modular.booking.R;
+import com.modular.booking.activity.utils.ShoppingCart;
+import com.modular.booking.model.Product;
+import com.modular.booking.model.ProductCategory;
+import com.modular.booking.widget.ShoppingCountView;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Created by Arison on 2018/1/24.
@@ -12,34 +27,100 @@ import com.core.widget.PinnedSectionListView;
 
 public class ItemDishPinnedListAdapter extends BaseAdapter implements PinnedSectionListView.PinnedSectionListAdapter{
 
+   private List<ProductCategory> productCategories=new ArrayList<>();
+   
+   private LayoutInflater layoutInflater;
+
+    private View mAnimTargetView;
+    
+   public ItemDishPinnedListAdapter(Context ct, List<ProductCategory> datas){
+       this.productCategories=datas;
+       this.layoutInflater=LayoutInflater.from(ct);
+       
+   }
 
+    public List<ProductCategory> getProductCategories() {
+        return productCategories;
+    }
+
+    public void setAnimTargetView(View animTargetView) {
+        mAnimTargetView = animTargetView;
+    }
     @Override
     public boolean isItemViewTypePinned(int viewType) {
-        return false;
+        
+       return viewType==ProductCategory.SECTION;
     }
 
     @Override
     public int getItemViewType(int position) {
-        return super.getItemViewType(position);
+        return productCategories.get(position).getType();
+    }
+    @Override
+    public int getViewTypeCount() {
+        return 2;
     }
 
     @Override
     public int getCount() {
-        return 0;
+        return productCategories.size();
     }
 
     @Override
-    public Object getItem(int i) {
-        return null;
+    public ProductCategory getItem(int i) {
+        return productCategories.get(i);
     }
 
     @Override
     public long getItemId(int i) {
-        return 0;
+        return i;
     }
+    
 
     @Override
-    public View getView(int i, View view, ViewGroup viewGroup) {
-        return null;
+    public View getView(int position, View convertView, ViewGroup viewGroup) {
+        
+       ProductCategory productCategory=productCategories.get(position);
+       if (productCategory.getType()==ProductCategory.SECTION){
+           convertView = layoutInflater.inflate(
+                   R.layout.item_dish_list_head, null);
+           TextView title=convertView.findViewById(R.id.txt_title);
+           title.setText(productCategory.getName());
+       }else if(productCategory.getType()==ProductCategory.ITEM){
+           convertView = layoutInflater.inflate(
+          R.layout.item_dish_list, null);
+          final Product product=productCategory.getProduct();
+           int quantity = ShoppingCart.getInstance().getQuantityForProduct(product);
+          ImageView img_product_photo=convertView.findViewById(R.id.img_product_photo);
+          AvatarHelper.getInstance().display("http://p0.meituan.net/deal/__16971854__3919079.jpg@380w_214h_1e_1c",img_product_photo,true);
+          TextView  txt_product_name=convertView.findViewById(R.id.txt_product_name);
+          TextView  txt_product_month_sales=convertView.findViewById(R.id.txt_product_month_sales);
+          TextView  txt_product_price =convertView.findViewById(R.id.txt_product_price);
+          ShoppingCountView shoppingCountView=convertView.findViewById(R.id.shopping_count_view);
+          shoppingCountView.setAnimTargetView(mAnimTargetView);
+          shoppingCountView.setShoppingCount(quantity);
+          shoppingCountView.setOnShoppingClickListener(new ShoppingCountView.ShoppingClickListener() {
+              @Override
+              public void onAddClick(int num) {
+                  if (!ShoppingCart.getInstance().add(product)) {
+                      
+                  }
+                  LogUtil.d("ShopCar", JSON.toJSONString(ShoppingCart.getInstance().getShoppingList()));
+              }
+
+              @Override
+              public void onMinusClick(int num) {
+                  if (!ShoppingCart.getInstance().delete(product)) {
+
+                  }
+                  LogUtil.d("ShopCar", JSON.toJSONString(ShoppingCart.getInstance().getShoppingList()));
+              }
+          });
+          txt_product_name.setText(productCategory.getProduct().getName());
+          txt_product_month_sales.setText("月售0");
+          txt_product_price.setText("¥"+productCategory.getProduct().getUnitItems().get(0).getPrice());
+       }
+        
+        return convertView;
     }
 }

+ 108 - 0
app_modular/appbooking/src/main/java/com/modular/booking/adapter/LayoutShoppingCartItemAdapter.java

@@ -0,0 +1,108 @@
+package com.modular.booking.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+import com.common.LogUtil;
+import com.core.app.MyApplication;
+import com.modular.booking.R;
+import com.modular.booking.activity.utils.ShoppingCart;
+import com.modular.booking.model.Product;
+import com.modular.booking.model.ShoppingEntity;
+import com.modular.booking.widget.ShoppingCountView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LayoutShoppingCartItemAdapter extends BaseAdapter {
+
+    private List<ShoppingEntity> objects = new ArrayList<ShoppingEntity>();
+
+    private Context context;
+    private LayoutInflater layoutInflater;
+
+    public LayoutShoppingCartItemAdapter(Context context) {
+        this.context = context;
+        this.layoutInflater = LayoutInflater.from(context);
+    }
+
+    @Override
+    public int getCount() {
+        return objects.size();
+    }
+
+    @Override
+    public ShoppingEntity getItem(int position) {
+        return objects.get(position);
+    }
+
+    public List<ShoppingEntity> getObjects() {
+        return objects;
+    }
+
+    public void setItems(List<ShoppingEntity> items) {
+        objects.clear();
+        objects.addAll(items);
+      notifyDataSetChanged();
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        if (convertView == null) {
+            convertView = layoutInflater.inflate(R.layout.layout_shopping_cart_item, null);
+            convertView.setTag(new ViewHolder(convertView));
+        }
+        initializeViews((ShoppingEntity)getItem(position), (ViewHolder) convertView.getTag());
+        return convertView;
+    }
+
+    private void initializeViews(ShoppingEntity entity, ViewHolder holder) {
+        holder.mNameTxt.setText(entity.getName());
+        holder.mPriceTxt.setText(MyApplication.getInstance().getString(R.string.label_price, entity.getTotalPrice()));
+
+        final Product finalProduct = entity.getProduct();
+        int quantity = ShoppingCart.getInstance().getQuantityForProduct(finalProduct);
+        LogUtil.d("ShopCar","更新商品数量:"+quantity);
+        holder. mShoppingCountView.setShoppingCount(quantity);
+        holder. mShoppingCountView.setOnShoppingClickListener(new ShoppingCountView.ShoppingClickListener() {
+            @Override
+            public void onAddClick(int num) {
+                if (!ShoppingCart.getInstance().add(finalProduct)) {
+                    LogUtil.d("ShopCar","添加商品失败!");
+                    int oldQuantity = ShoppingCart.getInstance().getQuantityForProduct(finalProduct);
+                    holder.  mShoppingCountView.setShoppingCount(oldQuantity);
+                }
+            }
+
+            @Override
+            public void onMinusClick(int num) {
+                if (!ShoppingCart.getInstance().delete(finalProduct)) {
+
+                    int oldQuantity = ShoppingCart.getInstance().getQuantityForProduct(finalProduct);
+                    holder. mShoppingCountView.setShoppingCount(oldQuantity);
+                }
+            }
+        });
+    }
+
+    protected class ViewHolder {
+        private TextView mNameTxt;
+        private TextView mPriceTxt;
+        private ShoppingCountView mShoppingCountView;
+
+        public ViewHolder(View view) {
+            mNameTxt = (TextView) view.findViewById(R.id.txt_name);
+            mPriceTxt = (TextView) view.findViewById(R.id.txt_price);
+            mShoppingCountView = (ShoppingCountView) view.findViewById(R.id.shopping_count_view);
+        }
+    }
+}

+ 30 - 0
app_modular/appbooking/src/main/java/com/modular/booking/adapter/ShoppingCartListAdapter.java

@@ -0,0 +1,30 @@
+package com.modular.booking.adapter;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import com.modular.booking.R;
+import com.modular.booking.adapter.holder.ShoppingCartItemViewHolder;
+import com.modular.booking.base.BaseAdapter;
+import com.modular.booking.model.ShoppingEntity;
+
+
+public class ShoppingCartListAdapter extends BaseAdapter<ShoppingEntity> {
+
+    @Override
+    public int getViewLayoutId(int viewType) {
+        return R.layout.layout_shopping_cart_item;
+    }
+
+    @Override
+    public ShoppingCartItemViewHolder createViewHolder(View view, int viewType) {
+        return new ShoppingCartItemViewHolder(view);
+    }
+
+    @Override
+    public void bindViewHolder(RecyclerView.ViewHolder holder, ShoppingEntity entity, int position) {
+        if (holder instanceof ShoppingCartItemViewHolder) {
+            ((ShoppingCartItemViewHolder) holder).bind(entity);
+        }
+    }
+}

+ 65 - 0
app_modular/appbooking/src/main/java/com/modular/booking/adapter/holder/ShoppingCartItemViewHolder.java

@@ -0,0 +1,65 @@
+package com.modular.booking.adapter.holder;
+
+import android.view.View;
+import android.widget.TextView;
+
+import com.common.LogUtil;
+import com.core.app.MyApplication;
+import com.modular.booking.R;
+import com.modular.booking.activity.utils.ShoppingCart;
+import com.modular.booking.base.BaseViewHolder;
+import com.modular.booking.model.Product;
+import com.modular.booking.model.ShoppingEntity;
+import com.modular.booking.widget.ShoppingCountView;
+
+/**
+ * author: cheikh.wang on 16/11/24
+ * email: wanghonghi@126.com
+ */
+
+public class ShoppingCartItemViewHolder extends BaseViewHolder<ShoppingEntity> {
+    
+    TextView mNameTxt;
+    TextView mPriceTxt;
+    ShoppingCountView mShoppingCountView;
+
+    public ShoppingCartItemViewHolder(View itemView) {
+        super(itemView);
+    }
+
+    @Override
+    protected void bindView(View view) {
+        mNameTxt= view.findViewById(R.id.txt_name);
+        mPriceTxt= view.findViewById(R.id.txt_price);
+        mShoppingCountView= view.findViewById(R.id.shopping_count_view);
+    }
+
+    public void bind(ShoppingEntity entity) {
+        mNameTxt.setText(entity.getName());
+        mPriceTxt.setText(MyApplication.getInstance().getString(R.string.label_price, entity.getTotalPrice()));
+        
+        final Product finalProduct = entity.getProduct();
+        int quantity = ShoppingCart.getInstance().getQuantityForProduct(finalProduct);
+        LogUtil.d("ShopCar","更新商品数量:"+quantity);
+        mShoppingCountView.setShoppingCount(quantity);
+        mShoppingCountView.setOnShoppingClickListener(new ShoppingCountView.ShoppingClickListener() {
+            @Override
+            public void onAddClick(int num) {
+                if (!ShoppingCart.getInstance().add(finalProduct)) {
+                    LogUtil.d("ShopCar","添加商品失败!");
+                    int oldQuantity = ShoppingCart.getInstance().getQuantityForProduct(finalProduct);
+                    mShoppingCountView.setShoppingCount(oldQuantity);
+                }
+            }
+
+            @Override
+            public void onMinusClick(int num) {
+                if (!ShoppingCart.getInstance().delete(finalProduct)) {
+             
+                    int oldQuantity = ShoppingCart.getInstance().getQuantityForProduct(finalProduct);
+                    mShoppingCountView.setShoppingCount(oldQuantity);
+                }
+            }
+        });
+    }
+}

+ 105 - 0
app_modular/appbooking/src/main/java/com/modular/booking/base/BaseAdapter.java

@@ -0,0 +1,105 @@
+package com.modular.booking.base;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.modular.booking.utils.ViewEventListener;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * author: cheikh.wang on 16/11/23
+ * email: wanghonghi@126.com
+ */
+public abstract class BaseAdapter<T> extends RecyclerView.Adapter implements IAdapter<T> {
+
+    private List<T> mItems;
+    private ViewEventListener<T> mViewEventListener;
+
+    public BaseAdapter() {
+        mItems = new ArrayList<>();
+    }
+
+    @Override
+    public void setItems(List<T> items) {
+        mItems.clear();
+        mItems.addAll(items);
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public void addItems(List<T> items) {
+        mItems.addAll(items);
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public void addItem(T item) {
+        mItems.add(item);
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public void delItem(T item) {
+        mItems.remove(item);
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public void clearItems() {
+        mItems.clear();
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public T getItem(int position) {
+        return mItems.get(position);
+    }
+
+    @Override
+    public void setViewEventListener(ViewEventListener<T> viewEventListener) {
+        mViewEventListener = viewEventListener;
+    }
+
+    @Override
+    public ViewEventListener<T> getViewEventListener() {
+        return mViewEventListener;
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public int getItemCount() {
+        return mItems != null ? mItems.size() : 0;
+    }
+
+    @Override
+    public final RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+        View view = LayoutInflater.from(parent.getContext())
+                .inflate(getViewLayoutId(viewType), parent, false);
+        return createViewHolder(view, viewType);
+    }
+
+    @Override
+    public final void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
+        if (viewHolder instanceof IViewHolder) {
+            IViewHolder<T> holder = (IViewHolder) viewHolder;
+            holder.setViewEventListener(mViewEventListener);
+            holder.setItem(getItem(position));
+            holder.setPosition(position);
+        }
+        bindViewHolder(viewHolder, getItem(position), position);
+    }
+
+    public abstract int getViewLayoutId(int viewType);
+
+    public abstract RecyclerView.ViewHolder createViewHolder(View view, int viewType);
+
+    public abstract void bindViewHolder(RecyclerView.ViewHolder holder, T item, int position);
+}

+ 25 - 0
app_modular/appbooking/src/main/java/com/modular/booking/base/IAdapter.java

@@ -0,0 +1,25 @@
+package com.modular.booking.base;
+
+
+import com.modular.booking.utils.ViewEventListener;
+
+import java.util.List;
+
+public interface IAdapter<T> {
+
+    void setItems(List<T> items);
+
+    void addItem(T item);
+
+    void delItem(T item);
+
+    void addItems(List<T> items);
+
+    void clearItems();
+
+    T getItem(int position);
+
+    ViewEventListener<T> getViewEventListener();
+
+    void setViewEventListener(ViewEventListener<T> viewEventListener);
+}

+ 13 - 0
app_modular/appbooking/src/main/java/com/modular/booking/base/IViewHolder.java

@@ -0,0 +1,13 @@
+package com.modular.booking.base;
+
+
+import com.modular.booking.utils.ViewEventListener;
+
+public interface IViewHolder<T> {
+
+    void setViewEventListener(ViewEventListener<T> viewEventListener);
+
+    void setItem(T item);
+
+    void setPosition(int position);
+}

+ 22 - 0
app_modular/appbooking/src/main/java/com/modular/booking/model/Product.java

@@ -12,6 +12,8 @@ import java.util.List;
 public class Product implements Parcelable {
 
     private String   Code;
+    private int DishCategoryId;//类别 索引
+    private String BusinessId="1000123";//商家编号
     private String   DishCategoryCode;
     private String   DishCategoryName;
     private String   Name;
@@ -23,6 +25,14 @@ public class Product implements Parcelable {
     public Product() {
     }
 
+    public String getBusinessId() {
+        return BusinessId;
+    }
+
+    public void setBusinessId(String businessId) {
+        BusinessId = businessId;
+    }
+
     public String getCode() {
         return Code;
     }
@@ -31,6 +41,14 @@ public class Product implements Parcelable {
         Code = code;
     }
 
+    public int getDishCategoryId() {
+        return DishCategoryId;
+    }
+
+    public void setDishCategoryId(int dishCategoryId) {
+        DishCategoryId = dishCategoryId;
+    }
+
     public String getDishCategoryCode() {
         return DishCategoryCode;
     }
@@ -87,6 +105,8 @@ public class Product implements Parcelable {
     @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeString(this.Code);
+        dest.writeInt(this.DishCategoryId);
+        dest.writeString(this.BusinessId);
         dest.writeString(this.DishCategoryCode);
         dest.writeString(this.DishCategoryName);
         dest.writeString(this.Name);
@@ -97,6 +117,8 @@ public class Product implements Parcelable {
 
     protected Product(Parcel in) {
         this.Code = in.readString();
+        this.DishCategoryId = in.readInt();
+        this.BusinessId = in.readString();
         this.DishCategoryCode = in.readString();
         this.DishCategoryName = in.readString();
         this.Name = in.readString();

+ 26 - 2
app_modular/appbooking/src/main/java/com/modular/booking/model/ProductCategory.java

@@ -14,17 +14,37 @@ public class ProductCategory implements Parcelable {
 
     public static final int ITEM = 0;
     public static final int SECTION = 1;
-    public int type; 
+    public int type=ProductCategory.SECTION; 
+    private int DishCategoryId;
     private String  ParentCode;
     private String  Code;
     private String  Name;
     
+    private Product product;
+    
+    
     private List<Product> products=new ArrayList<>();
 
+    public int getDishCategoryId() {
+        return DishCategoryId;
+    }
+
+    public void setDishCategoryId(int dishCategoryId) {
+        DishCategoryId = dishCategoryId;
+    }
+
+    public Product getProduct() {
+        return product;
+    }
+
+    public void setProduct(Product product) {
+        this.product = product;
+    }
+
     public List<Product> getProducts() {
         return products;
     }
-
+    
     public void setProducts(List<Product> products) {
         this.products = products;
     }
@@ -72,17 +92,21 @@ public class ProductCategory implements Parcelable {
     @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeInt(this.type);
+        dest.writeInt(this.DishCategoryId);
         dest.writeString(this.ParentCode);
         dest.writeString(this.Code);
         dest.writeString(this.Name);
+        dest.writeParcelable(this.product, flags);
         dest.writeTypedList(this.products);
     }
 
     protected ProductCategory(Parcel in) {
         this.type = in.readInt();
+        this.DishCategoryId = in.readInt();
         this.ParentCode = in.readString();
         this.Code = in.readString();
         this.Name = in.readString();
+        this.product = in.readParcelable(Product.class.getClassLoader());
         this.products = in.createTypedArrayList(Product.CREATOR);
     }
 

+ 121 - 0
app_modular/appbooking/src/main/java/com/modular/booking/model/ShoppingEntity.java

@@ -0,0 +1,121 @@
+package com.modular.booking.model;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Created by Arison on 2018/1/30.
+ */
+//购物车
+public class ShoppingEntity implements Parcelable {
+ 
+    String id;
+    String name;
+    int quantity;
+    double unitPrice;
+    double totalPrice;
+    Product product;
+
+    public static ShoppingEntity initWithProduct(Product product) {
+        ShoppingEntity entity = new ShoppingEntity();
+        try {
+            entity.setId(product.getCode());
+            entity.setName(product.getName());
+            entity.setUnitPrice(product.getUnitItems().get(0).getPrice());
+            entity.setQuantity(1);
+            entity.setProduct(product);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return entity;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(int quantity) {
+        this.quantity = quantity;
+        this.totalPrice = this.quantity * this.unitPrice;
+    }
+
+    public double getUnitPrice() {
+        return unitPrice;
+    }
+
+    public void setUnitPrice(double unitPrice) {
+        this.unitPrice = unitPrice;
+    }
+
+    public double getTotalPrice() {
+        return totalPrice;
+    }
+
+    public void setTotalPrice(double totalPrice) {
+        this.totalPrice = totalPrice;
+    }
+
+    public Product getProduct() {
+        return product;
+    }
+
+    public void setProduct(Product product) {
+        this.product = product;
+    }
+
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.id);
+        dest.writeString(this.name);
+        dest.writeInt(this.quantity);
+        dest.writeDouble(this.unitPrice);
+        dest.writeDouble(this.totalPrice);
+        dest.writeParcelable(this.product, flags);
+    }
+
+    public ShoppingEntity() {
+    }
+
+    protected ShoppingEntity(Parcel in) {
+        this.id = in.readString();
+        this.name = in.readString();
+        this.quantity = in.readInt();
+        this.unitPrice = in.readDouble();
+        this.totalPrice = in.readDouble();
+        this.product = in.readParcelable(Product.class.getClassLoader());
+    }
+
+    public static final Parcelable.Creator<ShoppingEntity> CREATOR = new Parcelable.Creator<ShoppingEntity>() {
+        @Override
+        public ShoppingEntity createFromParcel(Parcel source) {
+            return new ShoppingEntity(source);
+        }
+
+        @Override
+        public ShoppingEntity[] newArray(int size) {
+            return new ShoppingEntity[size];
+        }
+    };
+}

+ 21 - 0
app_modular/appbooking/src/main/java/com/modular/booking/utils/EventMessage.java

@@ -0,0 +1,21 @@
+package com.modular.booking.utils;
+
+/**
+ * Created by Arison on 2018/2/1.
+ */
+
+public class EventMessage {
+    Object object;
+
+    public EventMessage(Object object) {
+        this.object = object;
+    }
+
+    public Object getObject() {
+        return object;
+    }
+
+    public void setObject(Object object) {
+        this.object = object;
+    }
+}

+ 39 - 0
app_modular/appbooking/src/main/java/com/modular/booking/utils/RxBus.java

@@ -0,0 +1,39 @@
+package com.modular.booking.utils;
+import rx.Observable;
+import rx.subjects.PublishSubject;
+import rx.subjects.SerializedSubject;
+import rx.subjects.Subject;
+
+
+/**
+ * @author Arison
+ * PublishSubject 与普通的Subject不同,在订阅时并不立即触发订阅事件,而是允许我们在任意时刻手动调用onNext(),onError(),onCompleted来触发事件。
+ */
+public class RxBus {
+	
+	 private static volatile RxBus mDefaultInstance;
+
+	    private RxBus() {
+	    }
+
+	    public static RxBus getInstance() {
+	        if (mDefaultInstance == null) {
+	            synchronized (RxBus.class) {
+	                if (mDefaultInstance == null) {
+	                    mDefaultInstance = new RxBus();
+	                }
+	            }
+	        }
+	        return mDefaultInstance;
+	    }
+
+	    private final Subject<Object, Object> _bus = new SerializedSubject<>(PublishSubject.create());
+
+	    public void send(Object o) {
+	        _bus.onNext(o);
+	    }
+
+	    public Observable<Object> toObservable() {
+	        return _bus;
+	    }
+}

+ 7 - 0
app_modular/appbooking/src/main/java/com/modular/booking/utils/ViewEventListener.java

@@ -0,0 +1,7 @@
+package com.modular.booking.utils;
+
+import android.view.View;
+
+public interface ViewEventListener<T> {
+   void onViewEvent(int actionId, T item, int position, View view);
+}

+ 646 - 0
app_modular/appbooking/src/main/java/com/modular/booking/widget/ShoppingCountView.java

@@ -0,0 +1,646 @@
+package com.modular.booking.widget;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ValueAnimator;
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.support.v4.content.ContextCompat;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Animation;
+import android.view.animation.AnimationSet;
+import android.view.animation.ScaleAnimation;
+import android.view.animation.TranslateAnimation;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import com.modular.booking.R;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * 购物车的加减号控件
+ */
+public class ShoppingCountView extends View {
+
+    private final static int DEFAULT_DURATION = 300;
+    private final static int DEFAULT_TEXT_SIZE_SP = 14;
+    private final static int DEFAULT_SPACE_DP = 5;
+    private final static int DEFAULT_TEXT_COLOR = Color.parseColor("#424242");
+
+    private final static int STATE_NONE_MINUS = 0;
+    private final static int STATE_PREP_DRAW_MINUS = 1;
+    private final static int STATE_STRETCH_MINUS = 2;
+    private final static int STATE_HAVE_MINUS = 3;
+    private final static int STATE_PREP_HIDE_MINUS = 4;
+
+    private Paint mCountPaint;
+    private Paint mAddBgPaint;
+    private Paint mAddTextPaint;
+    private Paint mMinusBgPaint;
+    private Paint mMinusTextPaint;
+
+    private int mState = STATE_NONE_MINUS;
+
+    private int mTextColor;
+    private int mTextSize;
+    private int mAddBtnBgColor;
+    private int mAddBtnTextColor;
+    private int mMinusBtnBgColor;
+    private int mMinusBtnTextColor;
+    private int mSpace;
+    private int mDuration;
+
+    private int mWidth;
+    private int mHeight;
+    private int mTextPosition;
+    private int mMinusBtnPosition;
+    private int mAngle;
+    private int mAlpha;
+
+    private boolean mIsExpand;
+    private int mShoppingCount;
+    private View mAnimTargetView;
+    private ShoppingClickListener mShoppingClickListener;
+
+    public ShoppingCountView(Context context) {
+        this(context, null, 0);
+    }
+
+    public ShoppingCountView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ShoppingCountView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+
+        TypedArray typeArray = getContext().obtainStyledAttributes(attrs, R.styleable.ShoppingCountView);
+
+        mTextColor = typeArray.getColor(R.styleable.ShoppingCountView_scv_text_color, DEFAULT_TEXT_COLOR);
+        mTextSize = (int) typeArray.getDimension(R.styleable.ShoppingCountView_scv_text_size, sp2px(DEFAULT_TEXT_SIZE_SP));
+
+        mAddBtnBgColor = typeArray.getColor(R.styleable.ShoppingCountView_scv_add_btn_bg_color,
+                ContextCompat.getColor(context, android.R.color.holo_blue_light));
+        mAddBtnTextColor = typeArray.getColor(R.styleable.ShoppingCountView_scv_add_btn_text_color,
+                ContextCompat.getColor(context, android.R.color.white));
+
+        mMinusBtnBgColor = typeArray.getColor(R.styleable.ShoppingCountView_scv_minus_btn_bg_color,
+                ContextCompat.getColor(context, android.R.color.white));
+        mMinusBtnTextColor = typeArray.getColor(R.styleable.ShoppingCountView_scv_minus_btn_text_color,
+                ContextCompat.getColor(context, android.R.color.holo_blue_light));
+
+        mSpace = (int) typeArray.getDimension(R.styleable.ShoppingCountView_scv_space, dp2px(DEFAULT_SPACE_DP));
+        mDuration = typeArray.getInt(R.styleable.ShoppingCountView_scv_duration, DEFAULT_DURATION);
+
+        typeArray.recycle();
+
+        initPaints();
+    }
+
+    /**
+     * 初始化各种画笔
+     */
+    private void initPaints() {
+        // 绘制数量的画笔
+        mCountPaint = new Paint();
+        mCountPaint.setColor(mTextColor);
+        mCountPaint.setTextSize(mTextSize);
+        mCountPaint.setStrokeWidth(mTextSize / 6);
+        mCountPaint.setAntiAlias(true);
+
+        // 绘制加号按钮背景的画笔
+        mAddBgPaint = new Paint();
+        mAddBgPaint.setColor(mAddBtnBgColor);
+        mAddBgPaint.setStyle(Paint.Style.FILL);
+        mAddBgPaint.setAntiAlias(true);
+
+        // 绘制加号的画笔
+        mAddTextPaint = new Paint();
+        mAddTextPaint.setColor(mAddBtnTextColor);
+        mAddTextPaint.setStyle(Paint.Style.STROKE);
+        mAddTextPaint.setAntiAlias(true);
+        mAddTextPaint.setStrokeWidth(mTextSize / 6);
+
+        // 绘制减号按钮背景的画笔
+        mMinusBgPaint = new Paint();
+        mMinusBgPaint.setColor(mMinusBtnBgColor);
+        mMinusBgPaint.setStyle(Paint.Style.FILL);
+        mMinusBgPaint.setAntiAlias(true);
+
+        // 绘制减号的画笔
+        mMinusTextPaint = new Paint();
+        mMinusTextPaint.setColor(mMinusBtnTextColor);
+        mMinusTextPaint.setStyle(Paint.Style.STROKE);
+        mMinusTextPaint.setAntiAlias(true);
+        mMinusTextPaint.setStrokeWidth(mTextSize / 6);
+    }
+
+    /**
+     * 触摸点是否在加号按钮内
+     * @param event
+     * @return
+     */
+    private boolean isClickAddBtn(MotionEvent event) {
+        PointF pointF = new PointF(event.getX(), event.getY());
+        PointF circle = new PointF(mWidth - mHeight / 2, mHeight / 2);
+        return Math.pow((pointF.x - circle.x), 2) + Math.pow((pointF.y - circle.y), 2) <= Math.pow(mHeight / 2, 2);
+    }
+
+    /**
+     * 触摸点是否在减号按钮内
+     * @param event
+     * @return
+     */
+    private boolean isClickMinusBtn(MotionEvent event) {
+        PointF pointF = new PointF(event.getX(), event.getY());
+        PointF circle = new PointF(mHeight / 2, mHeight / 2);
+        return Math.pow((pointF.x - circle.x), 2) + Math.pow((pointF.y - circle.y), 2) <= Math.pow(mHeight / 2, 2);
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                if (mState == STATE_HAVE_MINUS && isClickMinusBtn(event)) {
+                    mShoppingCount--;
+                    if (mShoppingClickListener != null) {
+                        mShoppingClickListener.onMinusClick(mShoppingCount);
+                    }
+                    if (mShoppingCount == 0) {
+                        mState = STATE_PREP_HIDE_MINUS;
+                        mIsExpand = false;
+                    }
+                    requestLayout();
+                }
+                if (isClickAddBtn(event)) {
+                    mShoppingCount++;
+                    if (mShoppingClickListener != null) {
+                        mShoppingClickListener.onAddClick(mShoppingCount);
+                    }
+                    if (mShoppingCount == 1) {
+                        mState = STATE_PREP_DRAW_MINUS;
+                        mIsExpand = true;
+                    }
+                    if (mAnimTargetView != null) {
+                        startParabolaAnim(this, mAnimTargetView);
+                    }
+                    requestLayout();
+                }
+                break;
+        }
+        return super.onTouchEvent(event);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        mHeight = mTextSize / 2 * 3;
+        mWidth = mHeight * 2 + mSpace * 2 + getTextWidth(String.valueOf(mShoppingCount), mCountPaint);
+        setMeasuredDimension(mWidth, mHeight);
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+
+        if (mState == STATE_NONE_MINUS) {
+            drawAddButton(canvas);
+        } else if (mState == STATE_PREP_DRAW_MINUS) {
+            mState = STATE_STRETCH_MINUS;
+            drawAddButton(canvas);
+            startStretchAnim();
+        } else if (mState == STATE_STRETCH_MINUS) {
+            mMinusBgPaint.setAlpha(mAlpha);
+            mMinusTextPaint.setAlpha(mAlpha);
+            mCountPaint.setAlpha(mAlpha);
+            drawAddButton(canvas);
+            drawMinusBtn(canvas);
+            drawCountText(canvas);
+        } else if (mState == STATE_HAVE_MINUS) {
+            mMinusBgPaint.setAlpha(255);
+            mMinusTextPaint.setAlpha(255);
+            mCountPaint.setAlpha(255);
+            drawAddButton(canvas);
+            drawMinusBtn(canvas);
+            drawCountText(canvas);
+        } else if (mState == STATE_PREP_HIDE_MINUS) {
+            mState = STATE_STRETCH_MINUS;
+            drawAddButton(canvas);
+            startStretchAnim();
+        }
+    }
+
+    /**
+     * 绘制加号按钮
+     * @param canvas
+     */
+    private void drawAddButton(Canvas canvas) {
+        // 绘制加号的背景圆形
+        canvas.drawCircle(mWidth - mHeight / 2, mHeight / 2, mHeight / 2, mAddBgPaint);
+        // 绘制竖线
+        canvas.drawLine(mWidth - mHeight / 2, mHeight / 4, mWidth - mHeight / 2, mHeight / 4 * 3, mAddTextPaint);
+        // 绘制横线
+        canvas.drawLine(mWidth - mHeight / 2 - mHeight / 4, mHeight / 2, mWidth - mHeight / 4, mHeight / 2, mAddTextPaint);
+    }
+
+    /**
+     * 绘制选购数量的文本
+     * @param canvas
+     */
+    private void drawCountText(Canvas canvas) {
+        if (mState == STATE_STRETCH_MINUS) {
+            if (mAngle != 0) {
+                canvas.rotate(mAngle, mTextPosition, mHeight / 2);
+            }
+            int x = (int) (mTextPosition - getTextWidth(String.valueOf(mShoppingCount), mCountPaint) / 2f);
+            int y = (int) (mHeight / 2 + getTextHeight(String.valueOf(mShoppingCount), mCountPaint) / 2f);
+            canvas.drawText(String.valueOf(mShoppingCount), x, y, mCountPaint);
+
+            if (mAngle != 0) {
+                canvas.rotate(-mAngle, x, y);
+            }
+        } else {
+            int x = (int) (mWidth / 2 - getTextWidth(String.valueOf(mShoppingCount), mCountPaint) / 2f);
+            int y = (int) (mHeight / 2 + getTextHeight(String.valueOf(mShoppingCount), mCountPaint) / 2f);
+            canvas.drawText(String.valueOf(mShoppingCount), x, y, mCountPaint);
+        }
+    }
+
+    /**
+     * 绘制减号按钮
+     * @param canvas
+     */
+    private void drawMinusBtn(Canvas canvas) {
+        if (mState == STATE_STRETCH_MINUS) {
+            if (mAngle != 0) {
+                canvas.rotate(mAngle, mMinusBtnPosition, mHeight / 2);
+            }
+            canvas.drawCircle(mMinusBtnPosition, mHeight / 2, mHeight / 2, mMinusBgPaint);
+            mMinusTextPaint.setStrokeWidth(mTextSize / 10);
+            canvas.drawCircle(mMinusBtnPosition, mHeight / 2, mHeight / 2 - mHeight / 20, mMinusTextPaint);
+            mMinusTextPaint.setStrokeWidth(mTextSize / 6);
+            canvas.drawLine(mMinusBtnPosition - mHeight / 4, mHeight / 2, mMinusBtnPosition + mHeight / 4, mHeight / 2, mMinusTextPaint);
+
+            if (mAngle != 0) {
+                canvas.rotate(-mAngle, mMinusBtnPosition, mHeight / 2);
+            }
+        } else {
+            canvas.drawCircle(mHeight / 2, mHeight / 2, mHeight / 2, mMinusBgPaint);
+            mMinusTextPaint.setStrokeWidth(mTextSize / 10);
+            canvas.drawCircle(mHeight / 2, mHeight / 2, mHeight / 2 - mHeight / 20, mMinusTextPaint);
+            mMinusTextPaint.setStrokeWidth(mTextSize / 6);
+            canvas.drawLine(mHeight / 4, mHeight / 2, mHeight / 4 * 3, mHeight / 2, mMinusTextPaint);
+        }
+    }
+
+    /**
+     * 开始伸缩动画
+     */
+    private void startStretchAnim() {
+        Collection<Animator> animatorList = new ArrayList<>();
+
+        // 旋转购物车数量和减号的动画
+        ValueAnimator animatorTextRotate;
+        if (mIsExpand) {
+            animatorTextRotate = ValueAnimator.ofInt(0, 360);
+        } else {
+            animatorTextRotate = ValueAnimator.ofInt(360, 0);
+        }
+        animatorTextRotate.setDuration(mDuration);
+        animatorTextRotate.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator valueAnimator) {
+                mAngle = (Integer) valueAnimator.getAnimatedValue();
+                if (mIsExpand) {
+                    if (mAngle == 360) {
+                        mState = STATE_HAVE_MINUS;
+                    }
+                } else {
+                    if (mAngle == 0) {
+                        mState = STATE_NONE_MINUS;
+                    }
+                }
+            }
+        });
+        animatorList.add(animatorTextRotate);
+
+        // 渐变购物车数量和减号的动画
+        ValueAnimator animatorAlpha;
+        if (mIsExpand) {
+            animatorAlpha = ValueAnimator.ofInt(0, 255);
+        } else {
+            animatorAlpha = ValueAnimator.ofInt(255, 0);
+        }
+        animatorAlpha.setDuration(mDuration);
+        animatorAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator valueAnimator) {
+            mAlpha = (Integer) valueAnimator.getAnimatedValue();
+            if (mIsExpand) {
+                if (mAlpha == 255) {
+                    mState = STATE_HAVE_MINUS;
+                }
+            } else {
+                if (mAlpha == 0) {
+                    mState = STATE_NONE_MINUS;
+                }
+            }
+            }
+        });
+        animatorList.add(animatorAlpha);
+
+        // 购物车数量移动的动画
+        ValueAnimator animatorTextMove;
+        if (mIsExpand) {
+            animatorTextMove = ValueAnimator.ofInt(mWidth - mHeight / 2, mWidth / 2);
+        } else {
+            animatorTextMove = ValueAnimator.ofInt(mWidth / 2, mWidth - mHeight / 2);
+        }
+        animatorTextMove.setDuration(mDuration);
+        animatorTextMove.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator valueAnimator) {
+                mTextPosition = (Integer) valueAnimator.getAnimatedValue();
+                if (mIsExpand) {
+                    if (mTextPosition == mWidth / 2) {
+                        mState = STATE_HAVE_MINUS;
+                    }
+                } else {
+                    if (mTextPosition == mWidth - mHeight / 2) {
+                        mState = STATE_NONE_MINUS;
+                    }
+                }
+            }
+        });
+        animatorList.add(animatorTextMove);
+
+        // 减号移动的动画
+        ValueAnimator animatorBtnMove;
+        if (mIsExpand) {
+            animatorBtnMove = ValueAnimator.ofInt(mWidth - mHeight / 2, mHeight / 2);
+        } else {
+            animatorBtnMove = ValueAnimator.ofInt(mHeight / 2, mWidth - mHeight / 2);
+        }
+        animatorBtnMove.setDuration(mDuration);
+        animatorBtnMove.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator valueAnimator) {
+                mMinusBtnPosition = (Integer) valueAnimator.getAnimatedValue();
+                if (mIsExpand) {
+                    if (mMinusBtnPosition == mHeight / 2) {
+                        mState = STATE_HAVE_MINUS;
+                    }
+                } else {
+                    if (mMinusBtnPosition == mWidth - mHeight / 2) {
+                        mState = STATE_NONE_MINUS;
+                    }
+                }
+                requestLayout();
+            }
+        });
+        animatorList.add(animatorBtnMove);
+
+        AnimatorSet animatorSet = new AnimatorSet();
+        animatorSet.setDuration(mDuration);
+        animatorSet.playTogether(animatorList);
+        animatorSet.start();
+    }
+
+    /**
+     * 启动加入到购物车的动画
+     */
+    public void startParabolaAnim(View startView, View endView) {
+        // 创建一个覆盖在界面上的动画图层并生成对话对象
+        final ViewGroup animLayout = createAnimLayer();
+        if (animLayout == null) {
+            return;
+        }
+        final View animView = createAnimView(startView);
+        animLayout.addView(animView);
+        // 设置动画对象的初始位置
+        int[] animStartLoc = getViewLocation(startView);
+        setAnimStartLoc(animStartLoc, animView);
+        // 获取动画对象的终点位置
+        int[] animEndLoc = getViewLocation(endView);
+        //  根据起始位置和终点位置创建动画的轨迹
+        int[] offset = getAnimOffset(animStartLoc, animEndLoc);
+        final Animation animation = buildAnimation(offset);
+        // 设置动画的执行监听器
+        animation.setAnimationListener(new Animation.AnimationListener() {
+            @Override
+            public void onAnimationRepeat(Animation animation) {
+            }
+
+            @Override
+            public void onAnimationStart(Animation animation) {
+            }
+
+            @Override
+            public void onAnimationEnd(Animation animation) {
+                // 将动画图层移除
+                final ViewGroup parent = (ViewGroup) animLayout.getParent();
+                parent.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        parent.removeView(animLayout);
+                    }
+                });
+            }
+        });
+        animView.startAnimation(animation);
+    }
+
+    /**
+     * 创建动画层
+     *
+     * @return
+     */
+    private ViewGroup createAnimLayer() {
+        Context context = getContext();
+        if (context instanceof Activity) {
+            final ViewGroup decorView = (ViewGroup) ((Activity) context).getWindow().getDecorView();
+            LinearLayout ll = new LinearLayout(getContext());
+            ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
+                    LinearLayout.LayoutParams.MATCH_PARENT));
+            ll.setBackgroundResource(android.R.color.transparent);
+            decorView.addView(ll);
+            return ll;
+        }
+        return null;
+    }
+
+    /**
+     * 创建动画对象
+     *
+     * @param v
+     * @return
+     */
+    private View createAnimView(View v) {
+        v.buildDrawingCache();
+        Bitmap animBitmap = v.getDrawingCache();
+        ImageView ivAnim = new ImageView(getContext());
+        ivAnim.setImageBitmap(animBitmap);
+        return ivAnim;
+    }
+
+    /**
+     * 获得动画开始位置,即价格视图所在位置
+     *
+     * @param v
+     * @return
+     */
+    private int[] getViewLocation(View v) {
+        int[] location = new int[2];
+        v.getLocationOnScreen(location);
+        return location;
+    }
+
+    /**
+     * 设置动画起始位置
+     *
+     * @param startLoc
+     * @param animView
+     */
+    private void setAnimStartLoc(int[] startLoc, View animView) {
+        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
+                LinearLayout.LayoutParams.WRAP_CONTENT);
+        lp.leftMargin = startLoc[0];
+        lp.topMargin = startLoc[1];
+        animView.setLayoutParams(lp);
+    }
+
+    /**
+     * 获得动画x,y坐标的偏移量
+     *
+     * @param startLoc
+     * @param endLoc
+     * @return
+     */
+    private int[] getAnimOffset(int[] startLoc, int[] endLoc) {
+        int[] offset = new int[2];
+        offset[0] = endLoc[0] - startLoc[0];
+        offset[1] = endLoc[1] - startLoc[1];
+        return offset;
+    }
+
+    /**
+     * 根据偏移量创建动画
+     *
+     * @param offset
+     * @return
+     */
+    private Animation buildAnimation(int[] offset) {
+        AnimationSet as = new AnimationSet(false);
+        TranslateAnimation translateX = new TranslateAnimation(0, offset[0], 0, 0);
+        TranslateAnimation translateY = new TranslateAnimation(0, 0, 0, offset[1]);
+        translateY.setInterpolator(new AccelerateInterpolator());
+        ScaleAnimation scaleAnimation = new ScaleAnimation(1, 0, 1, 0);
+        scaleAnimation.setInterpolator(new AccelerateInterpolator());
+        as.addAnimation(scaleAnimation);
+        as.addAnimation(translateX);
+        as.addAnimation(translateY);
+        as.setDuration(500);
+        return as;
+    }
+
+    private int sp2px(float spValue) {
+        final float fontScale = getContext().getResources().getDisplayMetrics().scaledDensity;
+        return (int) (spValue * fontScale + 0.5f);
+    }
+
+    private int dp2px(float dpValue) {
+        float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                dpValue, getContext().getResources().getDisplayMetrics());
+        return (int) px;
+    }
+
+    private int getTextWidth(String str, Paint paint) {
+        int iRet = 0;
+        if (str != null && str.length() > 0) {
+            int len = str.length();
+            float[] widths = new float[len];
+            paint.getTextWidths(str, widths);
+            for (int j = 0; j < len; j++) {
+                iRet += (int) Math.ceil(widths[j]);
+            }
+        }
+        return iRet;
+    }
+
+    private int getTextHeight(String str, Paint paint) {
+        Rect rect = new Rect();
+        paint.getTextBounds(str, 0, str.length(), rect);
+        return (int) (rect.height() / 33f * 29);
+    }
+
+
+
+    /////////////////////////////////////////////////////
+    ///            以下是暴露给外部的公共方法              ///
+    /////////////////////////////////////////////////////
+
+    /**
+     * 设置购买数量
+     * @param shoppingCount
+     */
+    public void setShoppingCount(int shoppingCount) {
+        shoppingCount = shoppingCount > 0 ? shoppingCount : 0;
+        mShoppingCount = shoppingCount;
+        if (shoppingCount > 0) {
+            mState = STATE_HAVE_MINUS;
+        } else {
+            mState = STATE_NONE_MINUS;
+        }
+        requestLayout();
+    }
+
+    /**
+     * 设置加入到购物车动画的目标视图
+     * @param animTargetView
+     */
+    public void setAnimTargetView(View animTargetView) {
+        mAnimTargetView = animTargetView;
+    }
+
+    /**
+     * 获取加入到购物车动画的目标视图
+     * @param animTargetView
+     */
+    public View getAnimTargetView(View animTargetView) {
+        return mAnimTargetView;
+    }
+
+    /**
+     * 获取购物车数量
+     * @return
+     */
+    public int getShoppingCount() {
+        return mShoppingCount;
+    }
+
+    /**
+     * 设置监听器
+     * @param shoppingClickListener
+     */
+    public void setOnShoppingClickListener(ShoppingClickListener shoppingClickListener) {
+        mShoppingClickListener = shoppingClickListener;
+    }
+
+    public interface ShoppingClickListener {
+        void onAddClick(int num);
+
+        void onMinusClick(int num);
+    }
+}

binární
app_modular/appbooking/src/main/res/drawable-mdpi/icon_dish_shopcart_clear.png


binární
app_modular/appbooking/src/main/res/drawable-xhdpi/icon_dish_shopcart_clear.png


binární
app_modular/appbooking/src/main/res/drawable-xxhdpi/icon_dish_shopcart_clear.png


+ 6 - 0
app_modular/appbooking/src/main/res/drawable/selector_dish_menu.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@color/white" android:state_pressed="true"/>
+    <item android:drawable="@color/white" android:state_selected="true"/>
+    <item android:drawable="@color/bg_underlying"/>
+</selector>

+ 1 - 2
app_modular/appbooking/src/main/res/layout/activity_bservice_add.xml

@@ -445,8 +445,7 @@
                     jmf:contentTextColor="@color/black"
                     jmf:contentBackground="@color/me_menu_item_normal"
                     jmf:leftBackground="@drawable/icon_remove"
-                    jmf:rightBackground="@drawable/icon_add"
-                  >
+                    jmf:rightBackground="@drawable/icon_add">
                 </com.modular.booking.widget.AddSubUtils>
             </RelativeLayout>
 

+ 23 - 32
app_modular/appbooking/src/main/res/layout/activity_dish_select.xml

@@ -1,72 +1,63 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
-    tools:context="com.modular.booking.activity.services.DishSelectActivity">
-    <include layout="@layout/include_add_top"
-        android:id="@+id/dish_layout_top"></include>
-
+    android:background="#EDEDED">
+  <!--  <include layout="@layout/include_add_top"
+        android:id="@+id/dish_layout_top"
+        ></include>-->
+<!-- android:layout_below="@+id/dish_layout_top"-->
     <com.flipboard.bottomsheet.BottomSheetLayout
         android:id="@+id/bottom_sheet_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_below="@+id/dish_layout_top"
-     >
+        android:layout_marginBottom="50dp">
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-        <ListView
+        android:layout_height="match_parent">
+        <com.core.widget.CustomerListView
             android:id="@+id/lv_product_category"
             android:layout_width="100dp"
             android:layout_height="match_parent"
-            android:fadingEdge="none"
             android:scrollbars="none"
-            android:divider="@null"
-            android:choiceMode="singleChoice"/>
-        <View
-            android:layout_width="1px"
-            android:layout_height="match_parent"
-            android:background="@color/divider"
             />
         <com.core.widget.PinnedSectionListView
             android:id="@+id/lv_dish_product"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:cacheColorHint="#00000000"
-            android:gravity="fill" />
+            android:layout_height="wrap_content"
+            android:background="@color/white"
+            android:scrollingCache="false"
+            android:cacheColorHint="#00000000" />
     </LinearLayout>
-    
     </com.flipboard.bottomsheet.BottomSheetLayout>
     <!--底部购物车布局-->
-    <RelativeLayout
+    <FrameLayout
         android:id="@+id/rl_bottom"
         android:layout_width="match_parent"
+        android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
-        android:layout_height="60dp">
+        android:orientation="vertical">
 
         <LinearLayout
             android:id="@+id/ll_bottom"
             android:background="#CC000000"
             android:layout_width="match_parent"
             android:orientation="horizontal"
-          
-            android:layout_alignParentBottom="true"
+            android:layout_gravity="bottom"
             android:layout_height="50dp"
             android:weightSum="3">
             <TextView
             android:layout_width="wrap_content"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:layout_marginLeft="70dp"
-            android:textColor="@color/gray_light"
-            android:gravity="center_vertical"
-                android:layout_weight="2"
+            android:textColor="@color/gray_light" 
+            android:layout_gravity="center_vertical"
+            android:layout_weight="2"
             android:text="您的购物车空空如洗哦"/>
             <TextView
                 android:layout_width="wrap_content"
-                android:layout_height="match_parent"
+                android:layout_height="wrap_content"
                 android:layout_weight="1"
                 android:background="@drawable/shape_btn_blue_gradient"
                 android:textColor="@color/white"
@@ -77,9 +68,9 @@
         <ImageView
             android:layout_width="60dp"
             android:layout_height="60dp"
+            android:layout_gravity="bottom"
             android:layout_marginLeft="7dp"
             android:layout_marginBottom="7dp"
             android:src="@drawable/icon_shop_empty"/>
-        
-    </RelativeLayout>
+    </FrameLayout>
 </RelativeLayout>

+ 3 - 4
app_modular/appbooking/src/main/res/layout/item_dish_catagory_list.xml

@@ -1,11 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/rl_dish_top"
     android:layout_width="match_parent" 
     android:layout_height="match_parent"
     android:paddingLeft="10dp"
     android:paddingRight="10dp"
     android:paddingTop="8dp"
-    android:background="@drawable/list_selector_background"
+    android:background="@drawable/selector_dish_menu"
     android:paddingBottom="8dp">
     <TextView
         android:id="@+id/tv_name"
@@ -18,7 +19,5 @@
         android:layout_marginBottom="@dimen/dp_4"
         android:maxLines="2"
         android:text="热销榜"
-        android:textSize="@dimen/sp_14"
-        android:textColor="#9e9e9e" />
-
+        android:textSize="@dimen/sp_16" />
 </RelativeLayout>

+ 98 - 0
app_modular/appbooking/src/main/res/layout/item_dish_list.xml

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white">
+
+    <ImageView
+        android:id="@+id/img_product_photo"
+        android:layout_width="50dp"
+        android:layout_height="50dp"
+        android:scaleType="fitXY"
+        android:layout_margin="10dp"
+        android:src="@drawable/defaultpic"
+        />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@+id/img_product_photo"
+        android:layout_toEndOf="@+id/img_product_photo"
+        android:layout_margin="@dimen/dp_10"
+        android:orientation="vertical"
+        >
+
+        <TextView
+            android:id="@+id/txt_product_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="14sp"
+            android:textColor="#464646"
+            android:text="******"
+            />
+
+      <!--  <TextView
+            android:id="@+id/txt_product_description"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="12sp"
+            android:textColor="#8D8D8D"
+            />-->
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+
+            <TextView
+                android:id="@+id/txt_product_month_sales"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="12sp"
+                android:textColor="#CBCBCB"
+                android:text="月销售0"
+                />
+
+            <TextView
+                android:id="@+id/txt_product_price"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@+id/txt_product_month_sales"
+                android:textSize="14sp"
+                android:text="¥0"
+                android:textColor="@color/orange" />
+      <!--      <TextView
+                android:id="@+id/txt_product_left_num"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignTop="@id/txt_product_price"
+                android:layout_alignParentRight="true"
+                android:visibility="gone"
+                android:textSize="14sp" />-->
+     <com.modular.booking.widget.ShoppingCountView
+         android:id="@+id/shopping_count_view"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         android:layout_alignTop="@id/txt_product_price"
+         android:layout_alignParentRight="true"
+         android:layout_alignParentEnd="true"
+         app:scv_add_btn_bg_color="#3499DF"
+         app:scv_add_btn_text_color="@color/white"
+         app:scv_minus_btn_bg_color="@color/white"
+         app:scv_minus_btn_text_color="#3499DF"
+         android:visibility="visible">
+     </com.modular.booking.widget.ShoppingCountView>
+        </RelativeLayout>
+
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_alignParentBottom="true"
+        android:background="@color/divider"
+        />
+
+</RelativeLayout>

+ 44 - 0
app_modular/appbooking/src/main/res/layout/item_dish_list_head.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:background="@color/white"
+    >
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+   
+        android:background="@color/divider"
+        />
+    <TextView
+        android:id="@+id/txt_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:layout_marginTop="@dimen/dp_4"
+        android:layout_marginBottom="@dimen/dp_4"
+        android:layout_marginLeft="@dimen/dp_4"
+        android:layout_marginRight="@dimen/dp_4"
+        android:textSize="@dimen/sp_16"
+        android:text="*****"
+        />
+
+    <TextView
+        android:id="@+id/txt_desc"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="@dimen/dp_4"
+        android:layout_marginRight="@dimen/dp_4"
+        android:textSize="@dimen/sp_12"
+        android:textColor="@color/gray"
+  
+        android:visibility="gone"
+        />
+
+<!--
+   
+-->
+
+</LinearLayout>

+ 63 - 0
app_modular/appbooking/src/main/res/layout/layout_shopping_cart_item.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:background="@color/white"
+    >
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/dp_10"
+        android:gravity="center_vertical"
+        >
+
+        <TextView
+            android:id="@+id/txt_name"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:layout_margin="@dimen/dp_4"
+            android:singleLine="true"
+            tools:text="小炒肉"
+            android:textSize="@dimen/sp_16"
+            android:textColor="#424242"
+            />
+
+        <TextView
+            android:id="@+id/txt_price"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/dp_10"
+            android:layout_marginRight="@dimen/dp_10"
+            android:minWidth="60dp"
+            tools:text="¥12"
+            android:textSize="@dimen/sp_16"
+            android:textColor="@color/orange"
+            />
+
+        <com.modular.booking.widget.ShoppingCountView
+            android:id="@+id/shopping_count_view"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="@dimen/dp_4"
+            app:scv_add_btn_bg_color="#3499DF"
+            app:scv_add_btn_text_color="@color/white"
+            app:scv_minus_btn_bg_color="@color/white"
+            app:scv_minus_btn_text_color="#3499DF"
+            />
+
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_marginLeft="@dimen/dp_10"
+        android:layout_marginStart="@dimen/dp_10"
+        android:background="@color/divider"
+        />
+
+</LinearLayout>

+ 52 - 0
app_modular/appbooking/src/main/res/layout/layout_shopping_cart_panel.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:background="@color/white">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/dp_10"
+        android:gravity="center_vertical"
+        android:background="#F5F5F5">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="购物车"
+            android:textColor="#424242"
+            android:textSize="@dimen/sp_16"
+            />
+
+        <Space
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            />
+
+        <TextView
+            android:id="@+id/txt_clear"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:drawablePadding="@dimen/dp_4"
+            android:drawableLeft="@drawable/icon_dish_shopcart_clear"
+            android:drawableStart="@drawable/icon_dish_shopcart_clear"
+            android:text="@string/book_shopcart_clear"
+            android:textColor="#9e9e9e"
+            android:textSize="@dimen/sp_16"
+            />
+
+    </LinearLayout>
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:background="@color/divider"
+        />
+    <ListView
+        android:id="@+id/lv_data"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+    </ListView>
+</LinearLayout>

+ 1 - 0
app_modular/appbooking/src/main/res/values-en/strings.xml

@@ -39,6 +39,7 @@
     <string name="specified_hair_stylist">指定发型师</string>
     <string name="booking_serivce_teacher">特聘导师</string>
     <string name="booking_serivce_technician">特聘技师</string>
+    <string name="book_shopcart_clear">清空</string>
 
 
     <string-array name="booking_reject">

+ 1 - 0
app_modular/appbooking/src/main/res/values-zh-rCN/strings.xml

@@ -39,6 +39,7 @@
     <string name="specified_hair_stylist">指定发型师</string>
     <string name="booking_serivce_teacher">特聘导师</string>
     <string name="booking_serivce_technician">特聘技师</string>
+    <string name="book_shopcart_clear">清空</string>
 
 
     <string-array name="booking_reject">

+ 1 - 0
app_modular/appbooking/src/main/res/values-zh-rTW/strings.xml

@@ -39,6 +39,7 @@
     <string name="specified_hair_stylist">指定发型师</string>
     <string name="booking_serivce_teacher">特聘导师</string>
     <string name="booking_serivce_technician">特聘技师</string>
+    <string name="book_shopcart_clear">清空</string>
 
 
     <string-array name="booking_reject">

+ 6 - 0
app_modular/appbooking/src/main/res/values/strings.xml

@@ -40,6 +40,7 @@
     <string name="specified_hair_stylist">指定发型师</string>
     <string name="booking_serivce_teacher">特聘导师</string>
     <string name="booking_serivce_technician">特聘技师</string>
+    <string name="book_shopcart_clear">清空</string>
 
     <string-array name="booking_reject">
         <item>请选择拒绝理由</item>
@@ -47,4 +48,9 @@
         <item>没有必要</item>
         <item>其它</item>
     </string-array>
+
+
+    <string name="label_price">¥%1$.1f</string>
+    <string name="dialog_clear_shopping_cart_title">是否清空购物车?</string>
+    <string name="dialog_clear_shopping_cart_message">你确认清空购物车?一旦清空将不可恢复</string>
 </resources>

+ 11 - 2
app_modular/appbooking/src/main/res/values/styles.xml

@@ -10,6 +10,15 @@
         <item name="android:paddingRight">16dp</item>
         <item name="android:paddingTop">3dp</item>
     </style>
-    
-   
+
+    <declare-styleable name="ShoppingCountView">
+        <attr name="scv_text_color" format="color" />
+        <attr name="scv_text_size" format="dimension" />
+        <attr name="scv_add_btn_bg_color" format="color" />
+        <attr name="scv_add_btn_text_color" format="color" />
+        <attr name="scv_minus_btn_bg_color" format="color" />
+        <attr name="scv_minus_btn_text_color" format="color" />
+        <attr name="scv_space" format="dimension" />
+        <attr name="scv_duration" format="integer" />
+    </declare-styleable>
 </resources>

+ 2 - 2
app_modular/apputils/src/main/java/com/modular/apputils/activity/SimpleWebActivity.java

@@ -127,7 +127,7 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
         LogUtil.d(TAG, CommonUtil.getSharedPreferences(this, "erp_uu"));
         HttpClient httpClient = new HttpClient.Builder("https://account.ubtob.com/").build();
         httpClient.Api().send(new HttpClient.Builder()
-                .url("api/user/getToken")
+                .url("api/user/mobile/getToken")
                 .add("appId", "b2b")
                 .add("spaceDialectUID", CommonUtil.getSharedPreferences(this, "erp_uu"))
                 .add("uid", MyApplication.getInstance().mLoginUser.getTelephone())
@@ -139,7 +139,7 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
                 try {
                     LogUtil.d(TAG, o.toString());
                     String token = JSON.parseObject(o.toString()).getString("content");
-                    String url = "https://account.ubtob.com/sso/login/proxy?appId=b2b&returnURL=https://www.usoftmall.com&token=" + token + "&baseURL=https://www.usoftmall.com/login/other&isLoginAll=false";
+                    String url = "https://account.ubtob.com/sso/login/proxy?appId=b2b&returnURL=https://www.usoftmall.com/&token=" + token + "&baseURL=https://www.usoftmall.com/login/other&isLoginAll=false";
                     webView.loadUrl(url);
                 } catch (Exception e) {
                     e.printStackTrace();