use of de.schildbach.wallet.util.Toast in project bitcoin-wallet by bitcoin-wallet.
the class AcceptBluetoothService method onCreate.
@Override
public void onCreate() {
serviceCreatedAt = System.currentTimeMillis();
log.debug(".onCreate()");
super.onCreate();
this.application = (WalletApplication) getApplication();
this.wallet = application.getWallet();
final BluetoothAdapter bluetoothAdapter = checkNotNull(BluetoothAdapter.getDefaultAdapter());
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getClass().getName());
wakeLock.acquire();
registerReceiver(bluetoothStateChangeReceiver, new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
try {
classicThread = new AcceptBluetoothThread.ClassicBluetoothThread(bluetoothAdapter) {
@Override
public boolean handleTx(final Transaction tx) {
return AcceptBluetoothService.this.handleTx(tx);
}
};
paymentProtocolThread = new AcceptBluetoothThread.PaymentProtocolThread(bluetoothAdapter) {
@Override
public boolean handleTx(final Transaction tx) {
return AcceptBluetoothService.this.handleTx(tx);
}
};
classicThread.start();
paymentProtocolThread.start();
} catch (final IOException x) {
new Toast(this).longToast(R.string.error_bluetooth, x.getMessage());
CrashReporter.saveBackgroundTrace(x, application.packageInfo());
}
}
use of de.schildbach.wallet.util.Toast in project bitcoin-wallet by bitcoin-wallet.
the class RequestCoinsFragment method handleLocalApp.
private void handleLocalApp() {
final ComponentName component = new ComponentName(activity, SendCoinsActivity.class);
final PackageManager pm = activity.getPackageManager();
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(determineBitcoinRequestStr(false)));
try {
// launch intent chooser with ourselves excluded
pm.setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
startActivity(intent);
} catch (final ActivityNotFoundException x) {
new Toast(activity).longToast(R.string.request_coins_no_local_app_msg);
} finally {
pm.setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
}
activity.finish();
}
use of de.schildbach.wallet.util.Toast in project bitcoin-wallet by bitcoin-wallet.
the class RequestCoinsFragment method handleCopy.
private void handleCopy() {
final Uri request = Uri.parse(determineBitcoinRequestStr(false));
clipboardManager.setPrimaryClip(ClipData.newRawUri("Bitcoin payment request", request));
log.info("payment request copied to clipboard: {}", request);
new Toast(activity).toast(R.string.request_coins_clipboard_msg);
}
use of de.schildbach.wallet.util.Toast in project bitcoin-wallet by bitcoin-wallet.
the class SendingAddressesFragment method handleCopyToClipboard.
private void handleCopyToClipboard(final String address) {
clipboardManager.setPrimaryClip(ClipData.newPlainText("Bitcoin address", address));
log.info("sending address copied to clipboard: {}", address.toString());
new Toast(activity).toast(R.string.wallet_address_fragment_clipboard_msg);
}
Aggregations