Is it possible to use drawable resources bundled in your app instead of hosted images for adding stickers to Gboard?
Google provides the following code snippet here to show how to add a sticker to Gboard and it looks like the only way is to reference a hosted image:
new Indexable.Builder("Sticker")
.setName("Bye")
// add url for sticker asset
.setImage("http://www.snoopysticker.com?id=1234")
// see: Support links to your app content section
.setUrl("http://sticker/canonical/image/bye")
// Set the accessibility label for the sticker.
.setDescription("A sticker for Bye")
// Add search keywords.
.put("keywords", "bye", "snoopy", "see ya", "good bye")
.put("isPartOf",
new Indexable.Builder("StickerPack")
.setName("Snoopy Pack")
.build())
.build())};
All help is greatly appreciated!
String drawableResourceUri = Uri.parse("android.resource://your.package.name/drawable/yourfilenamewithoutextension").toString());
Add this string to your setUrl() method.
Google's AppIndexing sample project has an example of the files being generated at run time. This isn't exactly a Drawable resource but the same strategy can likely be used.
Related
So the simple idea is that I have SVG data as a string that I fetch from Internet.
I would like to show that as an icon in my app. Is there any way I can do this?
I have seen countless examples where SVG data is in a file located in the app's directory that is then showed but this is not what I am looking for. I literally have the data in XML format after http request and I only need to transform that to a Image or something else visible on the screen.
I have been trying to find a solution to this for hours now, so I would really appreciate some help :S
Android doesn't support svg with ImageView directly,you could display SVG with some commonly used third-party controls.
Like FFImageLoading.
Add Xamarin.FFImageLoading.Svg nuget package to platform project. Use ImageService with svg data resolver for displaying svg images.
For Android:
<ImageView
android:id="#+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
then use like:
var svgString = #"<svg><rect width=""30"" height=""30"" style=""fill:blue"" /></svg>";
ImageView imageView = FindViewById<ImageView>(Resource.Id.image_view);
ImageService.Instance
.LoadString(svgString)
.LoadingPlaceholder(placeHolderPath)
.WithCustomDataResolver(new SvgDataResolver(64, 0, true))
.WithCustomLoadingPlaceholderDataResolver(new SvgDataResolver(64, 0, true))
.Into(imageView);
I've been created an app on android and I'm using the com.android.camera.action.CROP intent to crop picture (the user can select the crop area).
I'm searching an easy way to do the same with objective-c as android could. I found some solution but it's only to crop with fixed parameter.
Do you have idea (github link, blog link...)?
Thanks in advance
if you want to use the third party libraries than here are the link,
pecropViewController
RSKImageCropper
or if you want to use inbuilt cropper of ios than when you create imagepicker controller object set it's property like this
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:NULL];
here picker.allowsEditing is the property which allow to crop image in square.
Hope, this will help you
There are so many good example available for crop image with Objective-C.
Please check few examples list as below.
PEPhotoCropEditor
TOCropViewController
BABCropperView
PhotoTweaks
MDImageCroper
InstagramPhotoPicker
RSKImageCropper
CropperView
VPImageCropper
PerfectImageCropper
I'm developing a EBookreading application, EBookDroid is a library which we are using for the PDF reading. If we have any links in the PDF like www.stackoverflow.com, when the user clicks on it, it supposed to open the link, for that i need to find out the coordinates of that link in the Document.
I am writing like the below.
final RectF linkRect = page.getLinkSourceRect(pageBounds, link);
But it's always giving the null back.
Try this may be use full
THIS EXAMPLE
I have yet another pesky question for people who understand how Google Drive SDK works. On Android platform, I am creating my own custom thumbnails for JPEG image files ( thumbnail is a reduced JPG of the most important detail of the parent image ), The size is a bit non-standard - 384 x 128px, but well within limits stated in the documentation. So, the code goes like this:
// thumbnail
String myThumb = "test.tnl";
Thumbnail tn = new Thumbnail();
tn.setMimeType("image/jpeg");
tn.setImage(Base64.encodeBase64String(myThumb.getBytes()));
// define meta-data
File body = new File();
body.setTitle("test.jpg");
body.setDescription("bla bla");
body.setMimeType("image/jpeg");
body.setThumbnail(tn);
File gooFl = drvSvc.files()
.insert(body, new FileContent("image/jpeg", new java.io.File(test.jpg)))
.execute();
and executes flawlessly (there are more 'body' elements I don't list here) and everything works like a charm. But when I download the image, my thumbnail is gone, replaced by standard Google thumbnail - s220 type.
I did notice the documentation statement:
As with indexable text, Drive automatically generates thumbnails for many common file types. For shortcuts and other file types Drive can not render, you can provide a thumbnail image generated by your application.
Reading it ambiguously, I was hoping that by supplying my own thumbnail to a known MIME type, I will keep Google Drive from generating its standard one, but it probably is not the case. So the question remains. Is there a solution to my problem? Having custom thumbnails for standard "image/jpeg" MIME types? Or is there a work-around, perhaps another custom field I can stick some 10Kb of binary data in? I need the thumbnails in my Android viewer - another app.
Thank you, sean
Google Drive will only use custom thumbnails for non-standard MIME types, so you can't override the one for jpeg. Your app can use a custom file property to store and read proprietary data:
https://developers.google.com/drive/properties
I am trying to open email activity and to display in the email's body the following:
Display a hyperlink to a web site.
Display (not attach) an image logo (.png file).
I tried using html/text/image mime type and nothing works for both things.
I even tried to copy the png file to an sdcard and displaying it from sdcard path instead of using the "Assets" location that may be restricted and private only to the application, but it did not help as well!
Can anyone give me a code which works for both things??
Waiting for you help guys!!
Have you tried :
Linkify.addLinks(yourEmailString, Linkify.WEB_URLS);
yourTextView.setMovementMethod(LinkMovementMethod.getInstance());
It will make all links in the message clickable, not sure if this is what you are searching though :)?