List of usage examples for android.content Context CLIPBOARD_SERVICE
String CLIPBOARD_SERVICE
To view the source code for android.content Context CLIPBOARD_SERVICE.
Click Source Link
From source file:com.fbbackup.TagImageDetailActivity.java
private void setListener() { btn_share.setOnClickListener(new Button.OnClickListener() { @Override/*w w w. j a v a 2s . co m*/ public void onClick(View v) { // TODO Auto-generated method stub // Gets a handle to the clipboard service. ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(clipBoardText); PackageManager pm = getPackageManager(); Intent intent = pm.getLaunchIntentForPackage("jp.naver.line.android"); startActivity(intent); } }); btn_download_photo.setOnClickListener(new ImageButton.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub DownloadSinglePicTask download = new DownloadSinglePicTask(); download.setContext(TagImageDetailActivity.this); download.setAlbunPhotoUrl(clipBoardText); Log.w("downloadpic", "ImageDetail albumName:" + albumName); download.setPath(extStorageDirectory + "/DCIM/FBBackup/" + name + "/TagMe" + "/"); download.execute("test"); } }); }
From source file:com.qiscus.sdk.ui.QiscusBaseChatActivity.java
protected void onSelectedCommentsAction(ActionMode mode, MenuItem item, List<QiscusComment> selectedComments) { int i = item.getItemId(); String text = ""; for (QiscusComment qiscusComment : selectedComments) { text += qiscusComment.getSender() + ": "; text += qiscusComment.isAttachment() ? qiscusComment.getAttachmentName() : qiscusComment.getMessage(); text += "\n"; }//from w ww .j av a2 s. c o m if (i == R.id.action_copy) { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.chat_activity_label_clipboard), text); clipboard.setPrimaryClip(clip); Toast.makeText(this, selectedComments.size() + " messages copied!", Toast.LENGTH_SHORT).show(); } else if (i == R.id.action_share) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Messages"); intent.putExtra(Intent.EXTRA_TEXT, text); startActivity(Intent.createChooser(intent, "Share")); } mode.finish(); }
From source file:at.alladin.rmbt.android.about.RMBTAboutFragment.java
private View createView(View view, LayoutInflater inflater) { activity = getActivity();/*from w w w. j a v a 2 s . co m*/ getAppInfo(activity); final String clientUUID = String.format("U%s", ConfigHelper.getUUID(activity.getApplicationContext())); final String controlServerVersion = ConfigHelper.getControlServerVersion(activity); final ListView listView = (ListView) view.findViewById(R.id.aboutList); final ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); HashMap<String, String> item; item = new HashMap<String, String>(); item.put("title", clientName); item.put("text1", this.getString(R.string.about_rtr_line1)); list.add(item); item = new HashMap<String, String>(); item.put("title", this.getString(R.string.about_version_title)); item.put("text1", clientVersion); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_clientid_title)); item.put("text1", clientUUID); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_web_title)); item.put("text1", getString(R.string.about_web_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_email_title)); item.put("text1", getString(R.string.about_email_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_terms_title)); item.put("text1", getString(R.string.about_terms_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_git_title)); item.put("text1", getString(R.string.about_git_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_dev_title)); item.put("text1", getString(R.string.about_dev_line1)); item.put("text2", getString(R.string.about_dev_line2)); list.add(item); final String openSourceSoftwareLicenseInfo = GooglePlayServicesUtil .getOpenSourceSoftwareLicenseInfo(getActivity()); if (openSourceSoftwareLicenseInfo != null) { item = new HashMap<String, String>(); item.put("title", getString(R.string.about_gms_legal_title)); item.put("text1", getString(R.string.about_gms_legal_line1)); item.put("text2", ""); list.add(item); } if (ConfigHelper.isDevEnabled(getActivity())) { item = new HashMap<String, String>(); item.put("title", getString(R.string.about_test_counter_title)); item.put("text1", Integer.toString(ConfigHelper.getTestCounter(getActivity()))); item.put("text2", ""); list.add(item); } item = new HashMap<String, String>(); item.put("title", getString(R.string.about_control_server_version)); item.put("text1", controlServerVersion != null ? controlServerVersion : "---"); item.put("text2", ""); list.add(item); sa = new RMBTAboutAdapter(getActivity(), list, R.layout.about_item, new String[] { "title", "text1", "text2" }, new int[] { R.id.title, R.id.text1, R.id.text2 }); listView.setAdapter(sa); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(final AdapterView<?> l, final View v, final int position, final long id) { switch (position) { case 1: handleHiddenCode(); break; case 2: final android.content.ClipboardManager clipBoard = (android.content.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("client_uuid", clientUUID); clipBoard.setPrimaryClip(clip); final Toast toast = Toast.makeText(getActivity(), R.string.about_clientid_toast, Toast.LENGTH_LONG); toast.show(); break; case 3: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_web_link)))); break; case 4: /* Create the Intent */ final Intent emailIntent = new Intent(Intent.ACTION_SEND); /* Fill it with Data */ emailIntent.setType("plain/text"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.about_email_email) }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.about_email_subject)); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); /* Send it off to the Activity-Chooser */ startActivity(Intent.createChooser(emailIntent, getString(R.string.about_email_sending))); break; case 5: final FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft; ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, new RMBTTermsFragment(), "terms"); ft.addToBackStack("terms"); ft.commit(); break; case 6: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_git_link)))); break; case 7: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_dev_link)))); break; case 8: final String licenseInfo = GooglePlayServicesUtil .getOpenSourceSoftwareLicenseInfo(getActivity()); AlertDialog.Builder licenseDialog = new AlertDialog.Builder(getActivity()); licenseDialog.setMessage(licenseInfo); licenseDialog.show(); break; default: break; } } }); return view; }
From source file:net.yolosec.upckeygen.ui.NetworkFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_share: try {// w w w .ja v a2 s . c om if (passwordList == null) return true; Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, wifiNetwork.getSsidName() + getString(R.string.share_msg_begin)); i.putExtra(Intent.EXTRA_TEXT, buildShareString()); startActivity(Intent.createChooser(i, getString(R.string.share_title))); } catch (Exception e) { Toast.makeText(getActivity(), R.string.msg_err_sendto, Toast.LENGTH_SHORT).show(); } return true; case R.id.menu_save_sd: if (passwordList == null) return true; final String toCopy = buildShareString(); try { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(toCopy); } else { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("Copied Text", toCopy); clipboard.setPrimaryClip(clip); } Toast.makeText(getActivity(), getString(R.string.msg_copied, wifiNetwork.getSsidName()), Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e(TAG, "Copy to clipboard failed", e); } return true; } return super.onOptionsItemSelected(item); }
From source file:com.mobshep.mobileshepherd.BrokenCrypto.java
public void copyMessage3(View v) { String copiedMessage3 = messageThree.getText().toString(); ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("message3", copiedMessage3); clipboard.setPrimaryClip(clip);//from w ww . j av a2 s .c o m showToast(); }
From source file:org.protocoderrunner.apprunner.api.PDevice.java
@ProtoMethod(description = "Copy the content into the clipboard", example = "") @ProtoMethodParam(params = { "label", "text" }) public void copyToClipboard(String label, String text) { ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(ClipData.newPlainText(label, text)); }
From source file:com.iiordanov.bVNC.RemoteCanvas.java
/** * Constructor used by the inflation apparatus * /*from ww w .java 2 s . c o m*/ * @param context */ public RemoteCanvas(final Context context, AttributeSet attrs) { super(context, attrs); clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); decoder = new Decoder(this); isRdp = getContext().getPackageName().contains("RDP"); isSpice = getContext().getPackageName().contains("SPICE"); final Display display = ((Activity) context).getWindow().getWindowManager().getDefaultDisplay(); displayWidth = display.getWidth(); displayHeight = display.getHeight(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); displayDensity = metrics.density; if (android.os.Build.MODEL.contains("BlackBerry") || android.os.Build.BRAND.contains("BlackBerry") || android.os.Build.MANUFACTURER.contains("BlackBerry")) { bb = true; } }
From source file:com.mobshep.mobileshepherd.BrokenCrypto.java
public void copyMessage4(View v) { String copiedMessage4 = messageFour.getText().toString(); ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("message4", copiedMessage4); clipboard.setPrimaryClip(clip);//from www . j av a 2 s. c o m showToast(); }
From source file:com.nick.scalpel.core.AutoFoundWirer.java
private void wireFromContext(Context context, AutoFound.Type type, int idRes, Resources.Theme theme, Field field, Object forWho) { Resources resources = context.getResources(); switch (type) { case STRING:/*ww w . j a v a 2s. co m*/ setField(field, forWho, resources.getString(idRes)); break; case COLOR: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { setField(field, forWho, resources.getColor(idRes, theme)); } else { //noinspection deprecation setField(field, forWho, resources.getColor(idRes)); } break; case INTEGER: setField(field, forWho, resources.getInteger(idRes)); break; case BOOL: setField(field, forWho, resources.getBoolean(idRes)); break; case STRING_ARRAY: setField(field, forWho, resources.getStringArray(idRes)); break; case INT_ARRAY: setField(field, forWho, resources.getIntArray(idRes)); break; case PM: setField(field, forWho, context.getSystemService(Context.POWER_SERVICE)); break; case ACCOUNT: setField(field, forWho, context.getSystemService(Context.ACCOUNT_SERVICE)); break; case ALARM: setField(field, forWho, context.getSystemService(Context.ALARM_SERVICE)); break; case AM: setField(field, forWho, context.getSystemService(Context.ACTIVITY_SERVICE)); break; case WM: setField(field, forWho, context.getSystemService(Context.WINDOW_SERVICE)); break; case NM: setField(field, forWho, context.getSystemService(Context.NOTIFICATION_SERVICE)); break; case TM: setField(field, forWho, context.getSystemService(Context.TELEPHONY_SERVICE)); break; case TCM: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setField(field, forWho, context.getSystemService(Context.TELECOM_SERVICE)); } break; case SP: setField(field, forWho, PreferenceManager.getDefaultSharedPreferences(context)); break; case PKM: setField(field, forWho, context.getPackageManager()); break; case HANDLE: setField(field, forWho, new Handler(Looper.getMainLooper())); break; case ASM: setField(field, forWho, context.getSystemService(Context.ACCESSIBILITY_SERVICE)); break; case CAP: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setField(field, forWho, context.getSystemService(Context.CAPTIONING_SERVICE)); } break; case KGD: setField(field, forWho, context.getSystemService(Context.KEYGUARD_SERVICE)); break; case LOCATION: setField(field, forWho, context.getSystemService(Context.LOCATION_SERVICE)); break; case SEARCH: setField(field, forWho, context.getSystemService(Context.SEARCH_SERVICE)); break; case SENSOR: setField(field, forWho, context.getSystemService(Context.SENSOR_SERVICE)); break; case STORAGE: setField(field, forWho, context.getSystemService(Context.STORAGE_SERVICE)); break; case WALLPAPER: setField(field, forWho, context.getSystemService(Context.WALLPAPER_SERVICE)); break; case VIBRATOR: setField(field, forWho, context.getSystemService(Context.VIBRATOR_SERVICE)); break; case CONNECT: setField(field, forWho, context.getSystemService(Context.CONNECTIVITY_SERVICE)); break; case NETWORK_STATUS: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { setField(field, forWho, context.getSystemService(Context.NETWORK_STATS_SERVICE)); } break; case WIFI: setField(field, forWho, context.getSystemService(Context.WIFI_SERVICE)); break; case AUDIO: setField(field, forWho, context.getSystemService(Context.AUDIO_SERVICE)); break; case FP: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { setField(field, forWho, context.getSystemService(Context.FINGERPRINT_SERVICE)); } break; case MEDIA_ROUTER: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { setField(field, forWho, context.getSystemService(Context.MEDIA_ROUTER_SERVICE)); } break; case SUB: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { setField(field, forWho, context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE)); } break; case IME: setField(field, forWho, context.getSystemService(Context.INPUT_METHOD_SERVICE)); break; case CLIP_BOARD: setField(field, forWho, context.getSystemService(Context.CLIPBOARD_SERVICE)); break; case APP_WIDGET: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setField(field, forWho, context.getSystemService(Context.APPWIDGET_SERVICE)); } break; case DEVICE_POLICY: setField(field, forWho, context.getSystemService(Context.DEVICE_POLICY_SERVICE)); break; case DOWNLOAD: setField(field, forWho, context.getSystemService(Context.DOWNLOAD_SERVICE)); break; case BATTERY: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setField(field, forWho, context.getSystemService(Context.BATTERY_SERVICE)); } break; case NFC: setField(field, forWho, context.getSystemService(Context.NFC_SERVICE)); break; case DISPLAY: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { setField(field, forWho, context.getSystemService(Context.DISPLAY_SERVICE)); } break; case USER: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { setField(field, forWho, context.getSystemService(Context.USER_SERVICE)); } break; case APP_OPS: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setField(field, forWho, context.getSystemService(Context.APP_OPS_SERVICE)); } break; case BITMAP: setField(field, forWho, BitmapFactory.decodeResource(resources, idRes, null)); break; } }
From source file:kr.rrcoporation.rrfestival.festival.activity.FestivalDetailActivity.java
@Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.button_facebook: break;/*from ww w . j a v a2 s . c o m*/ case R.id.textview_address: //TODO: check. // MapFragment.newInstance(bodyItem.getMapy(), bodyItem.getMapx(), "FROM_DETAIL"); ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("address", address.getText()); clipboard.setPrimaryClip(clip); Toast.makeText(this, " ?? .", Toast.LENGTH_SHORT) .show(); break; case R.id.imageview_share: sendLocationToKakao(); break; case R.id.fab: if (db == null) { db = this.openOrCreateDatabase("FESTIVALS.db", Context.MODE_PRIVATE, null); } saveBookmark(); break; } }