Пример #1
0
 /**
  * Call this view's onClick listener. Return true if it was called. Clicks are ignored if the cell
  * is empty.
  *
  * @return boolean
  */
 public boolean performClick() {
   if (!mEmpty) {
     showDialog("Details", promotionBeingDisplayed.getDescription());
     return super.performClick();
   }
   return false;
 }
Пример #2
0
  private void showDialog(String title, String details) {
    Dialog dialog = new Dialog(this.getContext());
    dialog.setContentView(R.layout.promodialog);
    ImageView image = (ImageView) dialog.findViewById(R.id.imageIndialog);
    image.setBackgroundDrawable(
        getContext().getResources().getDrawable(this.promotionBeingDisplayed.getPromotionImage()));
    TextView text = (TextView) dialog.findViewById(R.id.TextView01);
    ProductTable table = new ProductTable();
    Product product = table.findByBarcodeId(promotionBeingDisplayed.getProductID());
    String productDescription = promotionBeingDisplayed.getProductID();
    if (product != null) {
      productDescription = product.getName();
    }
    text.setText(productDescription);

    if (details != null && !details.trim().equals("")) {
      TextView extrDesc = (TextView) dialog.findViewById(R.id.extraDesc);
      extrDesc.setText(details);
    }

    dialog.setTitle(title);
    dialog.setCancelable(true);
    dialog.show();
  }