コード例 #1
0
  public void ClickedContinueButton(View view) {
    Log.d(TAG, "ClickedContinueButton");

    if (!orderInfo.isContactInfoCompleted()) {
      Toast.makeText(
              getApplicationContext(),
              getResources().getString(R.string.missingregistrationinfo),
              Toast.LENGTH_SHORT)
          .show();
      return;
    }

    if (Global.isUserLoggedIn(mContext)) {
      Global.setUserSharedPreferences(mContext, orderInfo);
    }

    /*
     * PAYMENT_INTENT_SALE will cause the payment to complete immediately.
     * Change PAYMENT_INTENT_SALE to PAYMENT_INTENT_AUTHORIZE to only
     * authorize payment and capture funds later.
     *
     * Also, to include additional payment details and an item list, see
     * getStuffToBuy() below.
     */
    PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);

    Intent intent = new Intent(mContext, PaymentActivity.class);

    intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);

    startActivityForResult(intent, REQUEST_CODE_PAYMENT);
  }
コード例 #2
0
  private void refreshDisplay() {
    if (orderInfo != null) {

      price.setText(orderInfo.getEstimatedCostAsString());
      time.setText("estimated time will be " + orderInfo.getEstimatedTimeAsString());

      if (orderInfo.isContactInfoCompleted() && !orderInfo.isContactInfoEmpty()) {
        String displayText = orderInfo.getCustomerContactName() + '\n';
        displayText += orderInfo.getCustomerEmail() + '\n';
        displayText += orderInfo.getCustomerPhone();

        registrationButton.setSingleLine(false);
        registrationButton.setText(displayText);
      } else {
        registrationButton.setSingleLine(true);
        registrationButton.setText(R.string.quote_registration_button_text);
      }
    } else {
      Intent intent = new Intent(mContext, LoginActivity.class);
      mContext.startActivity(intent);
      this.finish();
    }
  }