Ejemplo n.º 1
0
  private void setupUIData() {
    //        digitalAsset = (DigitalAsset) appSession.getData("asset_data");
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    toolbar.setTitle(digitalAsset.getName());

    //        if (digitalAsset.getImage() != null) {
    //            assetRedeemImage.setImageBitmap(BitmapFactory.decodeStream(new
    // ByteArrayInputStream(digitalAsset.getImage())));
    //        } else {
    //
    // assetRedeemImage.setImageDrawable(rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    //        }
    byte[] img = (digitalAsset.getImage() == null) ? new byte[0] : digitalAsset.getImage();
    BitmapWorkerTask bitmapWorkerTask =
        new BitmapWorkerTask(assetRedeemImage, res, R.drawable.img_asset_without_image, false);
    bitmapWorkerTask.execute(img); // todo comment to be able to compile

    assetRedeemNameText.setText(digitalAsset.getName());
    //        assetsToRedeemEditText.setText(digitalAsset.getAvailableBalanceQuantity() + "");
    assetsToRedeemEditText.setText(selectedRPCount + "");
    long quantity = digitalAsset.getAvailableBalanceQuantity();
    assetRedeemRemainingText.setText(
        quantity + ((quantity == 1) ? " Asset" : " Assets") + " Remaining");
  }
  private void setupUIData() {
    //        digitalAsset = (DigitalAsset) appSession.getData("asset_data");
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    toolbar.setTitle(digitalAsset.getName());

    //        if (digitalAsset.getImage() != null) {
    //            assetImageDetail.setImageBitmap(BitmapFactory.decodeStream(new
    // ByteArrayInputStream(digitalAsset.getImage())));
    //        } else {
    //
    // assetImageDetail.setImageDrawable(rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    //        }
    byte[] img = (digitalAsset.getImage() == null) ? new byte[0] : digitalAsset.getImage();
    BitmapWorkerTask bitmapWorkerTask =
        new BitmapWorkerTask(assetImageDetail, res, R.drawable.img_asset_without_image, false);
    bitmapWorkerTask.execute(img); // todo comment to compile, please review.

    assetDetailRedeemLayout.setVisibility(
        (digitalAsset.getAvailableBalanceQuantity() > 0) ? View.VISIBLE : View.GONE);
    assetDetailAppropriateLayout.setVisibility(
        (digitalAsset.getAvailableBalanceQuantity() > 0) ? View.VISIBLE : View.GONE);

    assetDetailNameText.setText(digitalAsset.getName());
    assetDetailExpDateText.setText(digitalAsset.getFormattedExpDate());

    long available = digitalAsset.getAvailableBalanceQuantity();
    long book = digitalAsset.getBookBalanceQuantity();
    availableText.setText(availableText(available));
    if (available == book) {
      pendingText.setVisibility(View.INVISIBLE);
    } else {
      long pendingValue = Math.abs(available - book);
      pendingText.setText(pendingText(pendingValue));
      pendingText.setVisibility(View.VISIBLE);
    }

    assetDetailBtcText.setText(digitalAsset.getFormattedAvailableBalanceBitcoin() + " BTC");
  }
Ejemplo n.º 3
0
  private void refreshUIData() {
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    assetRedeemNameText.setText(digitalAsset.getName());
    // assetsToDeliverEditText.setText(digitalAsset.getAvailableBalanceQuantity()+"");
    assetsToRedeemEditText.setText(selectedRPCount + "");
    assetRedeemRemainingText.setText(
        digitalAsset.getAvailableBalanceQuantity()
            + " "
            + getResources().getString(R.string.dap_user_wallet_remaining_assets));

    if (digitalAsset.getAvailableBalanceQuantity() == 0) {
      selectRPButton.setOnClickListener(null);
    }
  }