Android Open Source - openpizza-android Shop View Host






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.views.host;
/*from   ww w. j  av  a2 s. c  om*/
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.view.MenuItem;
import android.widget.EditText;
import de.openpizza.android.R;
import de.openpizza.android.ordermodul.NicknameHandler;
import de.openpizza.android.ordermodul.OrderFacade;
import de.openpizza.android.views.ShopView;

public class ShopViewHost extends ShopView implements NicknameHandler {

  @Override
  protected int getMenuId() {
    return R.menu.shop_view_host;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.create_order_button) {
      openOrderActivity();
      return true;
    }
    return super.onOptionsItemSelected(item);
  }

  private void openOrderActivity() {
    showGetNickDialog(this);
  }

  protected void showGetNickDialog(final NicknameHandler nh) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Enter nickname:");

    // Set up the input
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    builder.setView(input);

    // Set up the buttons
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
        String nickname = input.getText().toString();
        nh.getNickname(nickname);
      }

    });
    builder.setNegativeButton("Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
            finish();
          }
        });

    builder.show();

  }

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    OrderFacade.newOrder(super.getShopId(), this);

  }

  @Override
  public void getNickname(String nickname) {
    OrderFacade.setNickname(nickname);
    Intent intent = new Intent(getApplicationContext(),
        OrderActivityHost.class);
    startActivity(intent);
  }

}




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