private void setUpScreen(LayoutInflater layoutInflater) throws CantGetActiveLoginIdentityException { /** add navigation header */ addNavigationHeader( FragmentsCommons.setUpHeaderScreen( layoutInflater, getActivity(), referenceWalletSession.getIntraUserModuleManager().getActiveIntraUserIdentity())); /** Navigation view items */ NavigationViewAdapter navigationViewAdapter = new NavigationViewAdapter( getActivity(), null, referenceWalletSession.getIntraUserModuleManager().getActiveIntraUserIdentity()); setNavigationDrawer(navigationViewAdapter); }
/** * Bind ViewHolder * * @param holder ViewHolder object * @param data Object data to render * @param position position to render */ @Override protected void bindHolder( TransactionHistoryItemViewHolder holder, CryptoWalletTransaction data, int position) { try { holder.getContactIcon().setImageResource(R.drawable.mati_profile); holder .getTxt_amount() .setText( formatBalanceString( data.getBitcoinWalletTransaction().getAmount(), referenceWalletSession.getTypeAmount())); holder .getTxt_contactName() .setText(data.getInvolvedActor().getName()); // data.getContact().getActorName()); holder.getTxt_notes().setText(data.getBitcoinWalletTransaction().getMemo()); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.getDefault()); holder.getTxt_time().setText(sdf.format(data.getBitcoinWalletTransaction().getTimestamp())); ActorTransactionSummary actorTransactionSummary = null; try { actorTransactionSummary = cryptoWallet.getActorTransactionHistory( BalanceType.getByCode(referenceWalletSession.getBalanceTypeSelected()), referenceWalletSession.getWalletSessionType().getWalletPublicKey(), data.getInvolvedActor().getActorPublicKey()); } catch (CantGetActorTransactionHistoryException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(context, "Error en Adapter bindHolder", Toast.LENGTH_LONG).show(); } }
@Override public List<PaymentRequest> getMoreDataAsync(FermatRefreshTypes refreshType, int pos) { List<PaymentRequest> lstPaymentRequest = new ArrayList<PaymentRequest>(); try { lstPaymentRequest = cryptoWallet.listSentPaymentRequest(walletPublicKey, 10, offset); offset += MAX_TRANSACTIONS; } catch (Exception e) { referenceWalletSession .getErrorManager() .reportUnexpectedSubAppException( SubApps.CWP_WALLET_STORE, UnexpectedSubAppExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_FRAGMENT, e); e.printStackTrace(); } return lstPaymentRequest; }
/** * Bind ViewHolder * * @param holder ViewHolder object * @param data Object data to render * @param position position to render */ @Override protected void bindHolder(PaymentHomeItemViewHolder holder, PaymentRequest data, int position) { holder.getTxt_color_type().setBackgroundColor(paintColorRequestType(data.getType())); BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 2; // Bitmap bm = BitmapFactory.decodeResource((context.getResources(), R.drawable.mati_profile)), // options); Bitmap bitmap = MemoryUtils.decodeSampledBitmapFromResource( context.getResources(), R.drawable.mati_profile, holder.getContactIcon().getMaxWidth(), holder.getContactIcon().getMaxHeight()); holder.getContactIcon().setImageBitmap(bitmap); // holder.getContactIcon().setImageBitmap(ImagesUtils.getRoundedShape(BitmapFactory.decodeResource(context.getResources(), R.drawable.mati_profile))); // imageView_Item.setImageBitmap(getRoundedShape(BitmapFactory.decodeByteArray(checkBoxListItem.getIntraUserIdentity().getProfileImage(), 0, checkBoxListItem.getIntraUserIdentity().getProfileImage().length))); holder .getTxt_amount() .setText(formatBalanceString(data.getAmount(), referenceWalletSession.getTypeAmount())); holder.getTxt_amount().setTypeface(tf); holder.getTxt_contactName().setText("unknown"); // data.getContact().getActorName()); holder.getTxt_contactName().setTypeface(tf); holder.getTxt_notes().setText(data.getReason()); holder.getTxt_notes().setTypeface(tf); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.getDefault()); holder.getTxt_time().setText(data.getDate()); holder.getTxt_time().setTypeface(tf); holder.getBtn_accept_request().setOnClickListener(this); holder.getBtn_refuse_request().setOnClickListener(this); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); referenceWalletSession = (ReferenceWalletSession) walletSession; lstPaymentRequest = new ArrayList<PaymentRequest>(); try { cryptoWallet = referenceWalletSession.getCryptoWalletManager().getCryptoWallet(); lstPaymentRequest = getMoreDataAsync(FermatRefreshTypes.NEW, 0); // get init data } catch (Exception ex) { ex.printStackTrace(); // CommonLogger.exception(TAG, ex.getMessage(), ex); Toast.makeText( getActivity().getApplicationContext(), "Oooops! recovering from system error", Toast.LENGTH_SHORT) .show(); } }