use of com.samourai.wallet.widgets.ItemDividerDecorator 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;
}
}
}
use of com.samourai.wallet.widgets.ItemDividerDecorator in project samourai-wallet-android by Samourai-Wallet.
the class WhirlpoolCyclesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.whirlpool_cycles_list, container, false);
adapter = new WhirlpoolCyclesFragmentAdapter(new ArrayList<>());
cyclesList = view.findViewById(R.id.whirlpool_cycles_rv);
cyclesList.setLayoutManager(new LinearLayoutManager(getContext()));
cyclesList.setAdapter(adapter);
Drawable drawable = this.getResources().getDrawable(R.drawable.divider_grey);
cyclesList.addItemDecoration(new ItemDividerDecorator(drawable));
return view;
}
use of com.samourai.wallet.widgets.ItemDividerDecorator in project samourai-wallet-android by Samourai-Wallet.
the class BalanceActivity method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_balance);
balanceViewModel = ViewModelProviders.of(this).get(BalanceViewModel.class);
makePaynymAvatarcache();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
TxRecyclerView = findViewById(R.id.rv_txes);
progressBar = findViewById(R.id.progressBar);
toolbar = findViewById(R.id.toolbar);
mCollapsingToolbar = findViewById(R.id.toolbar_layout);
txSwipeLayout = findViewById(R.id.tx_swipe_container);
setSupportActionBar(toolbar);
TxRecyclerView.setLayoutManager(new LinearLayoutManager(this));
Drawable drawable = this.getResources().getDrawable(R.drawable.divider);
TxRecyclerView.addItemDecoration(new ItemDividerDecorator(drawable));
menuFab = findViewById(R.id.fab_menu);
txs = new ArrayList<>();
whirlpoolFab = findViewById(R.id.whirlpool_fab);
sendFab = findViewById(R.id.send_fab);
receiveFab = findViewById(R.id.receive_fab);
paynymFab = findViewById(R.id.paynym_fab);
findViewById(R.id.whirlpool_fab).setOnClickListener(view -> {
Intent intent = new Intent(BalanceActivity.this, WhirlpoolMain.class);
startActivity(intent);
menuFab.toggle(true);
});
sendFab.setOnClickListener(view -> {
Intent intent = new Intent(BalanceActivity.this, SendActivity.class);
intent.putExtra("via_menu", true);
intent.putExtra("_account", account);
startActivity(intent);
menuFab.toggle(true);
});
JSONObject payload = PayloadUtil.getInstance(BalanceActivity.this).getPayload();
if (account == 0 && payload != null && payload.has("prev_balance")) {
try {
setBalance(payload.getLong("prev_balance"), false);
} catch (Exception e) {
setBalance(0L, false);
}
} else {
setBalance(0L, false);
}
receiveFab.setOnClickListener(view -> {
menuFab.toggle(true);
try {
HD_Wallet hdw = HD_WalletFactory.getInstance(BalanceActivity.this).get();
if (hdw != null) {
Intent intent = new Intent(BalanceActivity.this, ReceiveActivity.class);
startActivity(intent);
}
} catch (IOException | MnemonicException.MnemonicLengthException e) {
}
});
paynymFab.setOnClickListener(view -> {
menuFab.toggle(true);
Intent intent = new Intent(BalanceActivity.this, PayNymHome.class);
startActivity(intent);
});
txSwipeLayout.setOnRefreshListener(() -> {
refreshTx(false, true, false);
txSwipeLayout.setRefreshing(false);
progressBar.setVisibility(View.VISIBLE);
});
IntentFilter filter = new IntentFilter(ACTION_INTENT);
LocalBroadcastManager.getInstance(BalanceActivity.this).registerReceiver(receiver, filter);
IntentFilter filterDisplay = new IntentFilter(DISPLAY_INTENT);
LocalBroadcastManager.getInstance(BalanceActivity.this).registerReceiver(receiverDisplay, filterDisplay);
if (!PermissionsUtil.getInstance(BalanceActivity.this).hasPermission(Manifest.permission.READ_EXTERNAL_STORAGE) || !PermissionsUtil.getInstance(BalanceActivity.this).hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
PermissionsUtil.getInstance(BalanceActivity.this).showRequestPermissionsInfoAlertDialog(PermissionsUtil.READ_WRITE_EXTERNAL_PERMISSION_CODE);
}
if (!PermissionsUtil.getInstance(BalanceActivity.this).hasPermission(Manifest.permission.CAMERA)) {
PermissionsUtil.getInstance(BalanceActivity.this).showRequestPermissionsInfoAlertDialog(PermissionsUtil.CAMERA_PERMISSION_CODE);
}
if (PrefsUtil.getInstance(BalanceActivity.this).getValue(PrefsUtil.PAYNYM_CLAIMED, false) == true && PrefsUtil.getInstance(BalanceActivity.this).getValue(PrefsUtil.PAYNYM_FEATURED_SEGWIT, false) == false) {
doFeaturePayNymUpdate();
} else if (PrefsUtil.getInstance(BalanceActivity.this).getValue(PrefsUtil.PAYNYM_CLAIMED, false) == false && PrefsUtil.getInstance(BalanceActivity.this).getValue(PrefsUtil.PAYNYM_REFUSED, false) == false) {
doClaimPayNym();
} else {
}
if (RicochetMeta.getInstance(BalanceActivity.this).getQueue().size() > 0) {
if (ricochetQueueTask == null || ricochetQueueTask.getStatus().equals(AsyncTask.Status.FINISHED)) {
ricochetQueueTask = new RicochetQueueTask();
ricochetQueueTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
}
if (!AppUtil.getInstance(BalanceActivity.this).isClipboardSeen()) {
doClipboardCheck();
}
if (!AppUtil.getInstance(BalanceActivity.this.getApplicationContext()).isServiceRunning(WebSocketService.class)) {
startService(new Intent(BalanceActivity.this.getApplicationContext(), WebSocketService.class));
}
setUpTor();
initViewModel();
progressBar.setVisibility(View.VISIBLE);
if (account == 0) {
final Handler delayedHandler = new Handler();
delayedHandler.postDelayed(() -> {
boolean notifTx = false;
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("notifTx")) {
notifTx = extras.getBoolean("notifTx");
}
refreshTx(notifTx, false, true);
updateDisplay(false);
}, 100L);
getSupportActionBar().setIcon(R.drawable.ic_samourai_logo_toolbar);
balanceViewModel.loadOfflineData();
} else {
getSupportActionBar().setIcon(R.drawable.ic_whirlpool);
receiveFab.setVisibility(View.GONE);
whirlpoolFab.setVisibility(View.GONE);
paynymFab.setVisibility(View.GONE);
new Handler().postDelayed(() -> updateDisplay(true), 600L);
}
boolean hadContentDescription = android.text.TextUtils.isEmpty(toolbar.getLogoDescription());
String contentDescription = String.valueOf(!hadContentDescription ? toolbar.getLogoDescription() : "logoContentDescription");
toolbar.setLogoDescription(contentDescription);
ArrayList<View> potentialViews = new ArrayList<View>();
toolbar.findViewsWithText(potentialViews, contentDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
View logoView = null;
if (potentialViews.size() > 0) {
logoView = potentialViews.get(0);
if (account == 0) {
logoView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent _intent = new Intent(BalanceActivity.this, BalanceActivity.class);
_intent.putExtra("_account", WhirlpoolMeta.getInstance(BalanceActivity.this).getWhirlpoolPostmix());
startActivity(_intent);
}
});
} else {
logoView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent _intent = new Intent(BalanceActivity.this, BalanceActivity.class);
_intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(_intent);
}
});
}
}
updateDisplay(false);
checkDeepLinks();
}
Aggregations