Android Open Source - openpizza-android Order






From Project

Back to project page openpizza-android.

License

The source code is released under:

MIT License

If you think the Android project openpizza-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.openpizza.android.ordermodul;
//w w w .  j  av  a2 s .c o m
import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import de.openpizza.android.service.data.DeliveryAddress;
import de.openpizza.android.service.data.Product;

public class Order {

  private List<ModelChangedListener> changedListeners = new ArrayList<ModelChangedListener>();
  private OrderBean orderBean;
  private CreateOrder createOrder;
  private SendOrder sendOrder;

  public void addListener(ModelChangedListener l) {
    changedListeners.add(l);
  }

  public Order(int shopid, Activity context) {
    this.orderBean = new OrderBean(this);
    this.orderBean.setShopid(shopid);
    this.createOrder = new CreateOrder(orderBean, context);
    this.sendOrder = new SendOrder(orderBean, context, context);
  }

  public Order(Activity context) {
    this.orderBean = new OrderBean(this);
    this.createOrder = new CreateOrder(orderBean, context);
    this.sendOrder = new SendOrder(orderBean, context, context);
  }

  public void createOrder() {
    createOrder.createOrderOnServer();
  }

  public void fetchOrder(String id) {
    createOrder.fetchOrder(id);
  }

  public void startPulling(Activity orderActivityHost) {
    sendOrder.startPulling(orderActivityHost);
  }

  public void sendProductList() {
    sendOrder.sendProductList();
  }

  public void fireModelChanged() {
    for (ModelChangedListener l : this.changedListeners) {
      l.onModelChanged(orderBean);
    }

  }

  public void addProduct(Product product, Integer quantity) {

    orderBean.addProduct(product, quantity.intValue());

  }

  public void setNickname(String nickname) {
    orderBean.setNickname(nickname);
  }

  public List<Product> getProductList() {
    return orderBean.getProductList();
  }

  public void sendOrderFinal(DeliveryAddress address, ModelChangedListener mcl) {
    createOrder.sendOrderFinal(address, mcl);
  }

  public void removeAllListener() {
    this.changedListeners.clear();
  }

}




Java Source Code List

de.openpizza.android.Category.java
de.openpizza.android.activitys.shopOverview.ShopOverviewActivity.java
de.openpizza.android.activitys.shopOverview.ShopOverviewCoordinator.java
de.openpizza.android.activitys.shopOverview.ShopOverviewFragment.java
de.openpizza.android.activitys.shopOverview.shopList.ShopListArrayAdapter.java
de.openpizza.android.activitys.shopOverview.shopList.ShopListItem.java
de.openpizza.android.activitys.shopOverview.shopList.ShopListView.java
de.openpizza.android.activitys.shopOverview.shopList.ShopList.java
de.openpizza.android.activitys.shop.ShopView.java
de.openpizza.android.ordermodul.CreateOrder.java
de.openpizza.android.ordermodul.DummyProvider.java
de.openpizza.android.ordermodul.ModelChangedListener.java
de.openpizza.android.ordermodul.NicknameHandler.java
de.openpizza.android.ordermodul.OrderBean.java
de.openpizza.android.ordermodul.OrderFacade.java
de.openpizza.android.ordermodul.OrderSyncAdapter.java
de.openpizza.android.ordermodul.Order.java
de.openpizza.android.ordermodul.SendOrder.java
de.openpizza.android.service.OrderContentService.java
de.openpizza.android.service.OrderService.java
de.openpizza.android.service.ShopIdService.java
de.openpizza.android.service.ShopsService.java
de.openpizza.android.service.data.DeliveryAddress.java
de.openpizza.android.service.data.OrderContentRequest.java
de.openpizza.android.service.data.OrderContentResponse.java
de.openpizza.android.service.data.OrderRequest.java
de.openpizza.android.service.data.OrderResponse.java
de.openpizza.android.service.data.Product.java
de.openpizza.android.service.data.Shop.java
de.openpizza.android.service.restapi.RESTServiceCall.java
de.openpizza.android.service.restapi.RESTServiceHandler.java
de.openpizza.android.service.restapi.RESTService.java
de.openpizza.android.views.LoginActivity.java
de.openpizza.android.views.OrderActivity.java
de.openpizza.android.views.ProductView.java
de.openpizza.android.views.SendOrderActivity.java
de.openpizza.android.views.ShopView.java
de.openpizza.android.views.antihost.LinkActivity.java
de.openpizza.android.views.antihost.OrderActivityAntihost.java
de.openpizza.android.views.antihost.ShopViewAntihost.java
de.openpizza.android.views.host.OrderActivityHost.java
de.openpizza.android.views.host.ShopViewHostEdit.java
de.openpizza.android.views.host.ShopViewHost.java
de.openpizza.android.views.shopview.CategoryFragment.java
de.openpizza.android.views.shopview.ShopViewTabsPagerAdapter.java
de.openpizza.android.views.shopview.ShowViewFragment.java