@Override public void onClick(View v) { switch (v.getId()) { case R.id.dialog_layout_add_truck_item_button_add: if (!CommonUtilities.isNetworkAvailable(mContext)) { Toast.makeText(mContext, "Network connection unavailable.", Toast.LENGTH_SHORT) .show(); break; } quantityToAdd = Double.parseDouble(addPartDialogQuantity.getText().toString()); if (quantityToAdd <= 0) { Toast.makeText(mContext, "Quantity Can't Be Null!", Toast.LENGTH_SHORT).show(); return; } if (!addPartDialog.isShowing()) addPartDialog.dismiss(); new SubmitTruckItemTask().execute(); break; case R.id.dialog_layout_add_truck_item_button_cancel: if (addPartDialog.isShowing()) addPartDialog.dismiss(); break; default: // Nothing break; } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_on_truck); headerLayout = (LinearLayout) findViewById(R.id.activity_header); mActivity = ActivityAppointmentOnTruckListView.this; mContext = this; final QuickAction accountMenu; accountMenu = AccountMenu.setupMenu(mContext, mActivity); headerButtonUser = (ImageView) headerLayout.findViewById(R.id.header_button_user); headerButtonBack = (ImageView) headerLayout.findViewById(R.id.header_button_back); headerButtonUser.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { accountMenu.show(v); accountMenu.setAnimStyle(QuickAction.ANIM_GROW_FROM_CENTER); } }); headerButtonBack.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.activity_on_truck_listview_truck_items); mNoneAvailable = (TextView) findViewById(R.id.activity_on_truck_textview_no_items); if (!CommonUtilities.isNetworkAvailable(mContext)) { Toast.makeText(mContext, "Network connection unavailable.", Toast.LENGTH_SHORT).show(); finish(); } else { new GetOnTruckItemsTask().execute(); } }