use of android.content.ClipData in project RxTools by vondear.
the class RxClipboardTool method getIntent.
/**
* 获取剪贴板的意图
*
* @return 剪贴板的意图
*/
public static Intent getIntent(Context context) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
return clip.getItemAt(0).getIntent();
}
return null;
}
use of android.content.ClipData in project RxTools by vondear.
the class RxClipboardTool method getText.
/**
* 获取剪贴板的文本
*
* @return 剪贴板的文本
*/
public static CharSequence getText(Context context) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
return clip.getItemAt(0).coerceToText(context);
}
return null;
}
use of android.content.ClipData in project run-wallet-android by runplay.
the class WalletTransfersItemDialog method onClick.
@Override
public void onClick(DialogInterface dialogInterface, int which) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
Fragment fragment;
final Bundle bundle = new Bundle();
switch(which) {
case 0:
String useAddress = transfer.getAddress();
try {
useAddress = Checksum.addChecksum(transfer.getAddress());
} catch (Exception e) {
}
ClipData clipAddress = ClipData.newPlainText(getActivity().getString(R.string.address), useAddress);
clipboard.setPrimaryClip(clipAddress);
break;
case 1:
ClipData clipHash = ClipData.newPlainText(getActivity().getString(R.string.hash), hash);
clipboard.setPrimaryClip(clipHash);
break;
case 2:
// Log.e("DIALOG","GO");
if (transfer.isMarkDoubleAddress()) {
Transfer gottransfer = Store.isAlreadyTransfer(hash, Store.getTransfers());
if (gottransfer != null) {
Store.setCacheTransfer(gottransfer);
UiManager.openFragmentBackStack(getActivity(), PendingCancelledFragment.class);
}
} else if (!transfer.isCompleted()) {
Transfer transfer = Store.getCurrentTransferFromHash(hash);
if (transfer != null) {
AppService.nudgeTransaction(getActivity(), Store.getCurrentSeed(), transfer);
}
} else {
Snackbar.make(getActivity().findViewById(R.id.drawer_layout), getString(R.string.messages_transaction_already_confirmed), Snackbar.LENGTH_LONG).show();
}
break;
case 3:
if (!transfer.isCompleted()) {
Transfer transfer = Store.getCurrentTransferFromHash(hash);
if (transfer != null) {
AppService.replayBundleTransaction(getActivity(), Store.getCurrentSeed(), hash, transfer.getAddress());
}
} else {
Snackbar.make(getActivity().findViewById(R.id.drawer_layout), getString(R.string.messages_transaction_already_confirmed), Snackbar.LENGTH_LONG).show();
}
}
}
use of android.content.ClipData in project run-wallet-android by runplay.
the class AboutFragment method onAboutDonationIotaAddressClick.
@OnClick(R.id.about_donation_iota_address)
public void onAboutDonationIotaAddressClick() {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(getActivity().getString(R.string.seed), Constants.DONATION_ADDRESS);
clipboard.setPrimaryClip(clip);
Snackbar.make(getView(), getString(R.string.messages_iota_donation), Snackbar.LENGTH_LONG).show();
}
use of android.content.ClipData in project run-wallet-android by runplay.
the class PendingCancelledFragment method onResume.
@Override
public void onResume() {
super.onResume();
if (Store.getCacheTransfer() == null) {
getActivity().onBackPressed();
} else {
View v = view.findViewById(R.id.transfer_card);
TransferViewManager.populateViewHolder(getActivity(), new TransferViewManager.ViewHolder(getActivity(), v), Store.getCacheTransfer(), false, -1, false);
List<TransferTransaction> transactions = new ArrayList<>();
transactions.addAll(Store.getCacheTransfer().getTransactions());
transactions.addAll(Store.getCacheTransfer().getOtherTransactions());
TransferViewManager.populateTransferTransactionOuts(getActivity(), breakdown, transactions, Store.getCacheTransfer());
cancelledHash.setText(Store.getCacheTransfer().getHash());
cancelledHash.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityMan.openAndroidBrowserUrl(getActivity(), sitesHash[0] + Store.getCacheTransfer().getHash());
}
});
copyClip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Transfer transfer = Store.getCacheTransfer();
if (transfer != null) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
StringBuilder sb = new StringBuilder();
sb.append("IOTA Transfer\n\n");
sb.append("time: " + Cal.getCal(transfer.getTimestamp()).getDatabaseDate());
sb.append("\nhash: " + transfer.getHash());
sb.append("\n\nTotal: " + transfer.getValue());
sb.append("\nStatus: " + (transfer.isCompleted() ? "Completed" : "Pending"));
sb.append("\nmilestone: " + transfer.getMilestone());
sb.append("\n\nAddress actions\n");
for (TransferTransaction tran : transfer.getTransactions()) {
sb.append(tran.getValue());
sb.append(" ");
sb.append(tran.getAddress());
}
for (TransferTransaction tran : transfer.getOtherTransactions()) {
sb.append(tran.getValue());
sb.append(" ");
sb.append(tran.getAddress());
}
sb.append("\n\nUsing run IOTA wallet, Android app http://iota.runplay.com");
ClipData clip = ClipData.newPlainText(getActivity().getString(R.string.seed), sb.toString());
clipboard.setPrimaryClip(clip);
Snackbar.make(getView(), getString(R.string.text_cancelled_copied), Snackbar.LENGTH_SHORT).show();
}
}
});
cancelledSites.setText(" " + sitesName[0]);
}
}
Aggregations