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"); }
@SuppressLint("SetTextI18n") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDescription = (FermatTextView) findViewById(R.id.description); mUsername = (FermatTextView) findViewById(R.id.user_name); mSecondDescription = (FermatTextView) findViewById(R.id.second_description); mTitle = (FermatTextView) findViewById(R.id.title); positiveBtn = (FermatButton) findViewById(R.id.positive_button); negativeBtn = (FermatButton) findViewById(R.id.negative_button); mSecondDescription.setVisibility(View.VISIBLE); positiveBtn.setOnClickListener(this); negativeBtn.setOnClickListener(this); mSecondDescription.setText(secondDescription != null ? secondDescription : ""); mDescription.setText(description != null ? description : ""); mUsername.setText(username != null ? username : ""); mTitle.setText(title != null ? title : ""); }