use of android.content.ClipboardManager in project Klyph by jonathangerbaud.
the class ImageFragment method handleCopyTextAction.
private void handleCopyTextAction(Comment comment) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("Comment", comment.getMessage());
clipboard.setPrimaryClip(clip);
}
use of android.content.ClipboardManager in project glide by bumptech.
the class FullscreenActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fullscreen_activity);
String resultJson = getIntent().getStringExtra(EXTRA_RESULT_JSON);
final Api.GifResult result = new Gson().fromJson(resultJson, Api.GifResult.class);
ImageView gifView = (ImageView) findViewById(R.id.fullscreen_gif);
gifView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("giphy_url", result.images.original.url);
clipboard.setPrimaryClip(clip);
if (gifDrawable != null) {
if (gifDrawable.isRunning()) {
gifDrawable.stop();
} else {
gifDrawable.start();
}
}
}
});
RequestBuilder<Drawable> thumbnailRequest = Glide.with(this).load(result).apply(decodeTypeOf(Bitmap.class));
Glide.with(this).load(result.images.original.url).thumbnail(thumbnailRequest).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
if (resource instanceof GifDrawable) {
gifDrawable = (GifDrawable) resource;
} else {
gifDrawable = null;
}
return false;
}
}).into(gifView);
}
use of android.content.ClipboardManager in project Meizhi by drakeet.
the class Androids method copyToClipBoard.
public static void copyToClipBoard(Context context, String text, String success) {
ClipData clipData = ClipData.newPlainText("meizhi_copy", text);
ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
manager.setPrimaryClip(clipData);
Toast.makeText(context, success, Toast.LENGTH_SHORT).show();
}
use of android.content.ClipboardManager in project qianghongbao by lendylongli.
the class MainActivity method showQrDialog.
/** 二维码*/
private void showQrDialog() {
final Dialog dialog = new Dialog(this, R.style.QR_Dialog_Theme);
View view = getLayoutInflater().inflate(R.layout.qr_dialog_layout, null);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String id = getString(R.string.qr_wx_id);
ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", id);
clipboardManager.setPrimaryClip(clip);
//跳到微信
Intent wxIntent = getPackageManager().getLaunchIntentForPackage(WechatAccessbilityJob.WECHAT_PACKAGENAME);
if (wxIntent != null) {
try {
startActivity(wxIntent);
} catch (Exception e) {
}
}
Toast.makeText(getApplicationContext(), "已复制到粘贴板", Toast.LENGTH_LONG).show();
QHBApplication.eventStatistics(MainActivity.this, "copy_qr");
dialog.dismiss();
}
});
dialog.setContentView(view);
dialog.show();
}
use of android.content.ClipboardManager in project GeekNews by codeestX.
the class SystemUtil method copyToClipBoard.
/**
* 保存文字到剪贴板
* @param context
* @param text
*/
public static void copyToClipBoard(Context context, String text) {
ClipData clipData = ClipData.newPlainText("url", text);
ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
manager.setPrimaryClip(clipData);
ToastUtil.shortShow("已复制到剪贴板");
}
Aggregations