Esempio n. 1
0
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.dap_wallet_asset_user_main_fragment, container, false);
    assetsView = (RecyclerView) rootView.findViewById(R.id.assets);
    assetsView.setHasFixedSize(true);
    assetImageDetail = (ImageView) rootView.findViewById(R.id.asset_image);

    if (asset.getImage() != null) {
      assetImageDetail.setImageBitmap(
          BitmapFactory.decodeStream(new ByteArrayInputStream(asset.getImage())));
    } else {
      assetImageDetail.setImageDrawable(
          rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    }

    layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    assetsView.setLayoutManager(layoutManager);
    adapter = new DigitalAssetAdapter(getActivity());
    adapter.setPopupMenu(
        new com.bitdubai.fermat_dap_android_wallet_asset_user_bitdubai.interfaces.PopupMenu() {
          @Override
          public void onMenuItemClickListener(View menuView, DigitalAsset project, int position) {
            setAsset(project);
            PopupMenu popupMenu = new PopupMenu(getActivity(), menuView);
            MenuInflater inflater = popupMenu.getMenuInflater();
            inflater.inflate(R.menu.dap_wallet_asset_user_main, popupMenu.getMenu());
            popupMenu.setOnMenuItemClickListener(MainFragment.this);
            popupMenu.show();
          }
        });
    assetsView.setAdapter(adapter);
    return rootView;
  }
Esempio n. 2
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");
  }
Esempio n. 4
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);
    }
  }