コード例 #1
0
ファイル: PaymentAddDialog.java プロジェクト: koa73/P4Pay
  private void setViewHolder(Activity activity) {

    holder.name.setText(operation.getPartner());
    if (operation.getPhotoUri() != null) {
      holder.avatar.setImageURI(Uri.parse(operation.getPhotoUri()));
    } else {
      holder.avatar.setImageResource(R.drawable.sign_ruble_3);
    }

    if (mAdapter.isEmpty()) {

      holder.cardList.setVisibility(View.GONE);
      holder.PAN.setText(R.string.errMsgNoCard);

    } else {

      holder.cardList.setAdapter(mAdapter);
      holder.PAN.setVisibility(View.GONE);
    }

    holder.type.setText(operation.getTypeAsString());
    holder.textMsg.setText(operation.getTextMsg());
    holder.amount.addTextChangedListener(
        new AmountTextWatcher(holder.amount, holder.sum, holder.fee, operation));
  }
コード例 #2
0
ファイル: PaymentAddDialog.java プロジェクト: koa73/P4Pay
  @NonNull
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Activity activity = getActivity();
    operation = new Operation(activity, getArguments().getInt("operationType"));
    operation.setCurrency(643);

    final Payment payment = getArguments().getParcelable("selectedPayment");
    operation.setPhotoUri(payment.getPaymentAvatar());
    operation.setPartner(payment.getPaymentName());
    operation.setPaymentID(payment.getPaymentID());
    operation.setTextMsg(payment.getPaymentText());

    LayoutInflater inflater = activity.getLayoutInflater();
    @SuppressLint("InflateParams")
    final View view = inflater.inflate(R.layout.payment_add, null);

    holder = new ViewHolder(activity, view);
    mAdapter = new CardListAdapter(activity);
    setViewHolder(activity);

    holder.partner.setText(payment.getPartnerName());

    final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder
        .setView(view)
        .setPositiveButton(
            R.string.btnPay,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {}
            });

    return builder.create();
  }