use of com.samourai.wallet.util.LinearLayoutManagerWrapper in project samourai-wallet-android by Samourai-Wallet.
the class WhirlpoolMain method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_whirlpool_main);
Toolbar toolbar = findViewById(R.id.toolbar_whirlpool);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
whirlpoolBalance = findViewById(R.id.whirlpool_balance_textview);
collapsingToolbarLayout = findViewById(R.id.collapsing_toolbar_whirlpool_main);
amountSubText = findViewById(R.id.toolbar_subtext);
progressBar = findViewById(R.id.whirlpool_main_progressBar);
premixList = findViewById(R.id.rv_whirlpool_dashboard);
swipeRefreshLayout = findViewById(R.id.tx_swipe_container_whirlpool);
findViewById(R.id.whirlpool_fab).setOnClickListener(view -> showBottomSheetDialog());
premixList.setLayoutManager(new LinearLayoutManagerWrapper(this));
adapter = new MixAdapter(new ArrayList<>());
Drawable drawable = this.getResources().getDrawable(R.drawable.divider_grey);
premixList.addItemDecoration(new ItemDividerDecorator(drawable));
premixList.setAdapter(adapter);
long postMixBalance = APIFactory.getInstance(WhirlpoolMain.this).getXpubPostMixBalance();
long preMixBalance = APIFactory.getInstance(WhirlpoolMain.this).getXpubPreMixBalance();
whirlpoolBalance.setText(getBTCDecimalFormat(postMixBalance + preMixBalance).concat(" BTC"));
startWhirlpool();
Disposable disposable = AndroidWhirlpoolWalletService.getInstance().listenConnectionStatus().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(connectionStates -> {
if (connectionStates == AndroidWhirlpoolWalletService.ConnectionStates.CONNECTED) {
listenPoolState();
loadMixes(false);
}
});
compositeDisposable.add(disposable);
IntentFilter broadcastIntent = new IntentFilter(DISPLAY_INTENT);
LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(receiver, broadcastIntent);
collapsingToolbarLayout.setOnClickListener(view -> switchBalance());
swipeRefreshLayout.setOnRefreshListener(() -> {
Intent intent = new Intent(this, JobRefreshService.class);
intent.putExtra("notifTx", false);
intent.putExtra("dragged", true);
intent.putExtra("launch", false);
JobRefreshService.enqueueWork(getApplicationContext(), intent);
swipeRefreshLayout.setRefreshing(false);
progressBar.setVisibility(View.VISIBLE);
loadMixes(true);
});
}
use of com.samourai.wallet.util.LinearLayoutManagerWrapper in project samourai-wallet-android by Samourai-Wallet.
the class UTXOSActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_utxos);
toolbar = findViewById(R.id.toolbar_utxos);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (account == WhirlpoolMeta.getInstance(getApplicationContext()).getWhirlpoolPostmix()) {
getSupportActionBar().setTitle(getText(R.string.unspent_outputs_post_mix));
}
noteAmounts = new TreeMap<String, Long>();
tagAmounts = new TreeMap<String, Long>();
df.setMinimumIntegerDigits(1);
df.setMinimumFractionDigits(8);
df.setMaximumFractionDigits(8);
utxoList = findViewById(R.id.utxo_rv_list);
utxoList.setItemViewCacheSize(24);
utxoProgressBar = findViewById(R.id.utxo_progressBar);
utxoSwipeRefresh = findViewById(R.id.utxo_swipe_container);
adapter = new UTXOListAdapter();
adapter.setHasStableIds(true);
utxoList.setLayoutManager(new LinearLayoutManagerWrapper(this));
utxoList.addItemDecoration(new ItemDividerDecorator(getDrawable(R.color.disabled_white)));
utxoList.setAdapter(adapter);
loadUTXOs(false);
utxoSwipeRefresh.setOnRefreshListener(() -> {
loadUTXOs(false);
});
if (!APIFactory.getInstance(getApplicationContext()).walletInit) {
if (!shownWalletLoadingMessage) {
Snackbar.make(utxoList.getRootView(), "Please wait... your wallet is still loading ", Snackbar.LENGTH_LONG).show();
shownWalletLoadingMessage = true;
}
}
}
Aggregations