net.gsantner.opoc.util.ShareUtil Java Examples
The following examples show how to use
net.gsantner.opoc.util.ShareUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.java From memetastic with GNU General Public License v3.0 | 6 votes |
public void shareBitmapToOtherApp(Bitmap bitmap, Activity activity) { ShareUtil su = new ShareUtil(activity).setFileProviderAuthority(getString(R.string.app_fileprovider)); su.setChooserTitle(getString(R.string.share_meme_via__appspecific)); su.shareImage(bitmap, Bitmap.CompressFormat.JPEG, 65, "MT-meme"); /* File file = new File(getCacheDir(), getString(R.string.cached_picture_filename)); if (ContextUtils.get().writeImageToFileJpeg(file, bitmap)) { Uri imageUri = FileProvider.getUriForFile(this, getString(R.string.app_fileprovider), file); if (imageUri != null) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); shareIntent.setDataAndType(imageUri, getContentResolver().getType(imageUri)); shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri); activity.startActivity(Intent.createChooser(shareIntent, getString(R.string.main__share_meme_prompt))); } }*/ }
Example #2
Source File: MemeCreateActivity.java From memetastic with GNU General Public License v3.0 | 5 votes |
private Bitmap extractBitmapFromIntent(final Intent intent) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; Bitmap bitmap = null; if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND) && intent.getType().startsWith("image/")) { Uri imageURI = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (imageURI != null) { try { bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageURI); } catch (IOException e) { bitmap = null; e.printStackTrace(); } } } else if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_EDIT) && intent.getType().startsWith("image/")) { ShareUtil shu = new ShareUtil(this); _predefinedTargetFile = shu.extractFileFromIntent(intent); if (_predefinedTargetFile == null) { Toast.makeText(this, R.string.the_file_could_not_be_loaded, Toast.LENGTH_SHORT).show(); finish(); } bitmap = ContextUtils.get().loadImageFromFilesystem(_predefinedTargetFile, _app.settings.getRenderQualityReal()); } else { String imagePath = getIntent().getStringExtra(EXTRA_IMAGE_PATH); bitmap = ContextUtils.get().loadImageFromFilesystem(new File(imagePath), _app.settings.getRenderQualityReal()); } return bitmap; }
Example #3
Source File: TranslateActivity.java From Stringlate with MIT License | 5 votes |
private void exportToCopy() { String filename = mSelectedLocaleResources.getFilename(); String xml = mRepo.mergeDefaultTemplate(mSelectedLocale); new ShareUtil(this).setClipboard(xml); Toast.makeText(this, getString(R.string.xml_copied_to_clipboard, filename), Toast.LENGTH_SHORT).show(); }
Example #4
Source File: TranslateActivity.java From Stringlate with MIT License | 5 votes |
private void exportToHastebin() { String xml = mRepo.mergeDefaultTemplate(mSelectedLocale); final ShareUtil shu = new ShareUtil(this); shu.pasteOnHastebin(xml, (ok, url) -> { if (ok) { shu.setClipboard(url); } Toast.makeText(TranslateActivity.this, ok ? R.string.exported_to_hastebin : R.string.export_unsuccessful, Toast.LENGTH_SHORT).show(); }); }
Example #5
Source File: TranslateActivity.java From Stringlate with MIT License | 5 votes |
private void exportToEmail() { String xml = mRepo.mergeDefaultTemplate(mSelectedLocale); String subject = mRepo.getProjectName() + " - " + getString(R.string.updated_x_translation, mSelectedLocale, LocaleString.getEnglishDisplay(mSelectedLocale)); new ShareUtil(this).draftEmail(subject, xml, mRepo.settings.getProjectMail()); }