Esempio n. 1
0
 private void setupHeader(ItemType header, View view) {
   TextView title = (TextView) view.findViewById(android.R.id.title);
   if (title == null)
     throw new RuntimeException(
         "Your header layout must contain a TextView with the ID @android:id/title.");
   TextView subtitle = (TextView) view.findViewById(android.R.id.content);
   if (subtitle == null)
     throw new RuntimeException(
         "Your header layout must contain a TextView with the ID @android:id/content.");
   title.setText(header.getTitle());
   if (header.getContent() != null && !header.getContent().trim().isEmpty()) {
     subtitle.setVisibility(View.VISIBLE);
     subtitle.setText(header.getContent());
   } else subtitle.setVisibility(View.GONE);
   TextView button = (TextView) view.findViewById(android.R.id.button1);
   if (button == null)
     throw new RuntimeException(
         "The header layout must contain a TextView with the ID @android:id/button1.");
   if (header.getActionCallback() != null) {
     button.setVisibility(View.VISIBLE);
     button.setBackgroundColor(mAccentColor);
     String titleTxt = header.getActionTitle();
     if (header.getActionTitle() == null || header.getActionTitle().trim().isEmpty())
       titleTxt = getContext().getString(R.string.see_more);
     button.setText(titleTxt);
   } else button.setVisibility(View.GONE);
 }
Esempio n. 2
0
 protected boolean onProcessTitle(TextView title, ItemType Tab, int accentColor) {
   if (title == null) return false;
   title.setText(Tab.getTitle());
   title.setTextColor(accentColor);
   return true;
 }
Esempio n. 3
0
  /** Creates new form NewDetailsFrame */
  public ViewItemDetails(String itemId, ItemType item) {
    super();

    String currency = null;
    this.itemId = itemId;

    setTitle("Item Id: " + itemId);

    if (item.getTitle() != null) {
      itemDetailString = item.getTitle();
      // System.out.println("Found item: " + itemDetailString);
    }
    if (item.getPictureDetails() != null) {
      // System.out.println("Picture url is " + item.getPictureDetails().getGalleryURL());
      try {
        java.net.URL url = new java.net.URL(item.getPictureDetails().getGalleryURL());
        image = javax.imageio.ImageIO.read(url);
      } catch (java.io.IOException ie) {
        // ie.printStackTrace();
        // System.out.println("Image not found!!!");
        image = null;
      }
    }
    if (item.getCurrency() != null) {
      // System.out.println("Currency: " + item.getCurrency().value());
      currency = item.getCurrency().value();
    }
    if (item.getDescription() != null) {
      // System.out.println("Description: " + item.getDescription());
      desc = item.getDescription();
    }
    int i = 0;
    if (item.getBestOfferDetails() != null) {
      // System.out.println("Current bid: " + item.getBestOfferDetails());
      details[i] = "Current Bid: ";
      if (currency != null) {
        values[i] =
            currency + " " + String.valueOf(item.getBestOfferDetails().getBestOffer().getValue());
      } else {
        values[i] = String.valueOf(item.getBestOfferDetails().getBestOffer().getValue());
      }
      i++;
    }

    if (item.getBuyItNowPrice() != null) {
      details[i] = "Buy it Now: ";
      // System.out.println("Buy it now: " + item.getBuyItNowPrice().getValue());
      values[i] = String.valueOf(item.getBuyItNowPrice().getValue());
      if (currency != null) values[i] = values[i] + " " + currency;
      i++;
    }

    if (item.getTimeLeft() != null) {
      // System.out.println("End Time: " + item.getTimeLeft().toString());
      details[i] = "End Time: ";

      String timeLeft = "";
      if (item.getTimeLeft().getDays() != 0) {
        timeLeft = item.getTimeLeft().getDays() + " Days ";
      }
      if (item.getTimeLeft().getHours() != 0)
        timeLeft = timeLeft + item.getTimeLeft().getHours() + " Hrs ";
      if (item.getTimeLeft().getMinutes() != 0)
        timeLeft = timeLeft + item.getTimeLeft().getMinutes() + " Mins ";
      if (item.getTimeLeft().getSeconds() != 0)
        timeLeft = timeLeft + item.getTimeLeft().getSeconds() + " Secs ";

      values[i] = timeLeft;
      i++;
    }
    if (item.getQuantity() != null) {
      // System.out.println("Quantity: " + item.getQuantity());
      details[i] = "Quantity: ";
      values[i] = String.valueOf(item.getQuantity());
      i++;
    }

    if (item.getLocation() != null) {
      // System.out.println("Location: " + item.getLocation());
      details[i] = "Location: ";
      values[i] = item.getLocation();
    }

    initComponents();
    setVisible(true);
  }