@Override public void onClick(View inButton) { boolean isErr = false; if (mTitle.getText().toString().length() == 0) { mTitle.setError("Required"); mTitle.setEms(10); isErr = true; } if (mDesc.getText().toString().length() == 0) { mDesc.setActivated(true); mDesc.setError("Required"); isErr = true; } if (inButton.getId() == openWeb.getId()) web.setVisibility(View.VISIBLE); else if (inButton.getId() == mAvail.getId()) startActivity(new Intent(this, CheckActivity.class)); else if (inButton.getId() == mBack.getId()) finish(); else if (inButton.getId() == mSub.getId()) { AlertDialog.Builder al = new AlertDialog.Builder(this); if (isErr) return; else al.setTitle("Continue?") .setIcon(R.drawable.ornament) .setMessage("Your listing is going to be submitted to your chosen category.") .setPositiveButton( "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int x) { payment = new ArrayList<String>(); if (mCard.isChecked()) payment.add("Card"); if (mCheck.isChecked()) payment.add("Check"); if (mOnline.isChecked()) payment.add("Online"); if (mCash.isChecked()) payment.add("Cash"); // Toast.makeText(getApplicationContext(), payment.toString(), // Toast.LENGTH_LONG).show(); Intent intent = new Intent(getApplicationContext(), StartActivity.class); intent.putExtra("Payment", payment); intent.putExtra("Category", mChosenCategory); intent.putExtra("Title", mTitle.getText().toString()); intent.putExtra("Price", mPrice.getText().toString()); intent.putExtra("Description", mDesc.getText().toString()); intent.putExtra("Location", mLocation.getText().toString()); intent.putExtra("Photo", jpegData); startActivity(intent); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int x) {} }) .show(); } else startActivityForResult( new Intent(this, com.lightbox.android.camera.activities.Camera.class), REQ); }
/** * onClick * * <p>extracts the relai that was clicked, and asks the ipx to open then close the corresponding * relai */ @Override public void onClick(View view) { Ipx800Control ipx = context.getIpx(); if (view instanceof Button) { Button button = (Button) view; // Log.d(TAG, "hit the button " + button.getHint()+ "id = "+button.getId()); try { int port2trigger = Integer.parseInt("" + button.getHint()); // Log.d(TAG, "would trigger ipx out "+port2trigger); try { ipx.set(port2trigger, true); ipx.set(port2trigger, false); } catch (Exception e) { Toast.makeText(context, "error:" + e, Toast.LENGTH_LONG).show(); } } catch (NumberFormatException e) { // ok, we hit a special button.... if (button.getId() == R.id.servernameValue) context.callSettings(); else if (button.getHint().equals("fill_me")) context.callSettings(); // else Log.e(TAG,"unknown button code: "+button.getHint()); } } }