use of android.content.ClipboardManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CopyablePreference method copyPreference.
public static void copyPreference(Context context, CopyablePreference pref) {
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setText(pref.getCopyableText());
Toast.makeText(context, com.android.internal.R.string.text_copied, Toast.LENGTH_SHORT).show();
}
use of android.content.ClipboardManager in project AndroidUtilCode by Blankj.
the class ClipboardUtils method copyUri.
/**
* 复制uri到剪贴板
*
* @param uri uri
*/
public static void copyUri(Uri uri) {
ClipboardManager clipboard = (ClipboardManager) Utils.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(ClipData.newUri(Utils.getContext().getContentResolver(), "uri", uri));
}
use of android.content.ClipboardManager in project AndroidUtilCode by Blankj.
the class ClipboardUtils method getIntent.
/**
* 获取剪贴板的意图
*
* @return 剪贴板的意图
*/
public static Intent getIntent() {
ClipboardManager clipboard = (ClipboardManager) Utils.getContext().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.ClipboardManager in project AndroidUtilCode by Blankj.
the class ClipboardUtils method copyIntent.
/**
* 复制意图到剪贴板
*
* @param intent 意图
*/
public static void copyIntent(Intent intent) {
ClipboardManager clipboard = (ClipboardManager) Utils.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(ClipData.newIntent("intent", intent));
}
use of android.content.ClipboardManager in project CustomActivityOnCrash by Ereza.
the class DefaultErrorActivity method copyErrorToClipboard.
private void copyErrorToClipboard() {
String errorInformation = CustomActivityOnCrash.getAllErrorDetailsFromIntent(DefaultErrorActivity.this, getIntent());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(getString(R.string.customactivityoncrash_error_activity_error_details_clipboard_label), errorInformation);
clipboard.setPrimaryClip(clip);
} else {
//noinspection deprecation
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(errorInformation);
}
}
Aggregations