Search in sources :

Example 56 with ClipboardManager

use of android.content.ClipboardManager 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();
}
Also used : ClipboardManager(android.content.ClipboardManager) ClipData(android.content.ClipData) OnClick(butterknife.OnClick)

Example 57 with ClipboardManager

use of android.content.ClipboardManager 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]);
    }
}
Also used : ClipboardManager(android.content.ClipboardManager) ArrayList(java.util.ArrayList) Transfer(run.wallet.iota.model.Transfer) TransferViewManager(run.wallet.iota.ui.TransferViewManager) TransferTransaction(run.wallet.iota.model.TransferTransaction) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ClipData(android.content.ClipData)

Example 58 with ClipboardManager

use of android.content.ClipboardManager in project run-wallet-android by runplay.

the class SnTrFragment method hasClipboardAddress.

private boolean hasClipboardAddress() {
    ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData cd = clipboard.getPrimaryClip();
    if (cd != null && cd.getItemCount() > 0) {
        String address = cd.getItemAt(0).coerceToText(getActivity()).toString();
        // Log.e("CLIPB","has add? : "+isValidAddress(address)+" -- "+address);
        return isValidAddress(address);
    }
    return false;
}
Also used : ClipboardManager(android.content.ClipboardManager) ClipData(android.content.ClipData)

Example 59 with ClipboardManager

use of android.content.ClipboardManager in project xabber-android by redsolution.

the class ChatFragment method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (menuItems != null && menuItems.size() > position) {
        HashMap<String, String> menuItem = menuItems.get(position);
        switch(menuItem.get(CustomMessageMenuAdapter.KEY_ID)) {
            case "action_message_repeat":
                if (MessageItem.isUploadFileMessage(clickedMessageItem)) {
                    uploadFile(clickedMessageItem.getFilePath());
                } else {
                    sendMessage(clickedMessageItem.getText());
                }
                break;
            case "action_message_copy":
                Spannable spannable = MessageItem.getSpannable(clickedMessageItem);
                ((ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText(spannable, spannable));
                break;
            case "action_message_appeal":
                setInputTextAtCursor(clickedMessageItem.getResource().toString() + ", ");
                break;
            case "action_message_quote":
                setInputTextAtCursor("> " + clickedMessageItem.getText() + "\n");
                break;
            case "action_message_remove":
                MessageManager.getInstance().removeMessage(clickedMessageItem.getUniqueId());
                break;
            case "action_message_open_muc_private_chat":
                UserJid occupantFullJid = null;
                try {
                    occupantFullJid = UserJid.from(JidCreate.domainFullFrom(user.getJid().asDomainBareJid(), clickedMessageItem.getResource()));
                    MessageManager.getInstance().openChat(account, occupantFullJid);
                    startActivity(ChatActivity.createSpecificChatIntent(getActivity(), account, occupantFullJid));
                } catch (UserJid.UserJidCreateException e) {
                    LogManager.exception(this, e);
                }
                break;
            case "action_message_show_original_otr":
                chatMessageAdapter.addOrRemoveItemNeedOriginalText(clickedMessageItem.getUniqueId());
                chatMessageAdapter.notifyDataSetChanged();
                break;
            case "action_message_status":
                if (clickedMessageItem.isError())
                    showError(clickedMessageItem.getErrorDescription());
                break;
            default:
                break;
        }
    }
}
Also used : ClipboardManager(android.content.ClipboardManager) UserJid(com.xabber.android.data.entity.UserJid) Spannable(android.text.Spannable)

Example 60 with ClipboardManager

use of android.content.ClipboardManager in project Klyph by jonathangerbaud.

the class ConversationFragment method handleCopyTextAction.

@TargetApi(11)
private void handleCopyTextAction(Message message) {
    ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clip = ClipData.newPlainText("Message", message.getBody());
    clipboard.setPrimaryClip(clip);
}
Also used : ClipboardManager(android.content.ClipboardManager) ClipData(android.content.ClipData) TargetApi(android.annotation.TargetApi)

Aggregations

ClipboardManager (android.content.ClipboardManager)125 ClipData (android.content.ClipData)82 Intent (android.content.Intent)17 View (android.view.View)15 TextView (android.widget.TextView)13 Context (android.content.Context)10 Paint (android.graphics.Paint)9 DialogInterface (android.content.DialogInterface)7 Bundle (android.os.Bundle)7 AlertDialog (android.support.v7.app.AlertDialog)7 Editable (android.text.Editable)7 TextPaint (android.text.TextPaint)7 ImageView (android.widget.ImageView)6 TargetApi (android.annotation.TargetApi)5 Spanned (android.text.Spanned)5 AlertDialog (android.app.AlertDialog)4 Uri (android.net.Uri)4 ColorDrawable (android.graphics.drawable.ColorDrawable)3 Drawable (android.graphics.drawable.Drawable)3 MenuItem (android.view.MenuItem)3