Giphy / giphy-android-sdk

Home of the GIPHY SDK Android example app, along with Android SDK documentation, issue tracking, & release notes.
https://developers.giphy.com/
Mozilla Public License 2.0
94 stars 37 forks source link

Where do we find the full SDK documentation? #147

Closed tfrysinger closed 2 years ago

tfrysinger commented 3 years ago

This seems to be the for the Kotlin based app example only. Where does the documentation (Java/Kotlin) reside that details all the various classes in the SDK? How to use them, etc.?

ALexanderLonsky commented 3 years ago

hey @tfrysinger, we don't provide the full API reference document, but you can find all the needed information here.

You can refer to this snippet to use the SDK in the java project.

tfrysinger commented 3 years ago

Well, sorry but I've been through your giphy-android-sdk page many times and while it is a nice start it certainly doesn't provide "all the needed information". If I want to use GPHClient for example, how do I do so? If I want to actually download a .gif (not just give it to GPHMediaView to show) from within my Android app that the user has chosen through the fragment dialog, how do I do that?

Thanks.

Tad

On Tue, Aug 17, 2021 at 12:49 AM ALexanderLonsky @.***> wrote:

hey @tfrysinger https://github.com/tfrysinger, we don't provide the full API reference document, but you can find all the needed information here https://github.com/Giphy/giphy-android-sdk/blob/main/Docs.md.

You can refer to this https://github.com/Giphy/giphy-android-sdk/issues/66#issuecomment-657659487 snippet to use the SDK in the java project.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Giphy/giphy-android-sdk/issues/147#issuecomment-900039998, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYB4GC7R6VAU4ZD5OPHVJDT5IBBLANCNFSM5CITGT6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

ALexanderLonsky commented 3 years ago

@tfrysinger

The SDK provides only two solutions for the user interface - pre-built templates which handle the entirety of the GIPHY experience, and a Grid-Only implementation that allows for customization.

Other than that, you can use GPHCore to find gifs by id/ids and create a GPHMediaView to display the media.

It's not supposed to use GPHApiClient directly. The latest SDK versions are not obfuscated because our customers had some issues due to obfuscation, that is why now you can access GPHApiClient. I'll try to fix that in the next release.

If I want to actually download a .gif (not just give it to GPHMediaView to show) from within my Android app that the user has chosen through the fragment dialog, how do I do that?

GiphyDialogFragment.GifSelectionListener.onGifSelected provides a Media object.

To get an actual URL to a media file you can access it via:

media.images.original.gifUrl

or

media.images.original.webPUrl

media.images includes all the possible renditions, so you can pick any you'd like to use.

-- Please let me know if you have any other questions.

tfrysinger commented 3 years ago

Thanks for the info - some follow-up questions:

  1. How would you recommend programmatically downloading a .gif using that url - DownloadManager?

  2. Where is GPHCore documented? I see one Kotlin snippet:

GPHCore.gifById(id) { result, e -> gifView.setMedia(result?.data, RenditionType.original) e?.let { //your code here } }

I think all of us really need these classes documented for Java users also! There are arguments that are optional in Kotlin and not optional when you are working in Java that aren't documented in your single page, and it would be helpful to understand what they are, what they are for, etc. For example, in the other snippet you sent me, it states:

Notice that for Giphy.INSTANCE.configure, you must set to True the third parameter only when you need to verify your developer's key. After they verify it then set it always to False.

This kind of begs the question - WHEN do I need to verify the developer key? Once when the app starts? Why? What happens if I don't?

  1. Is it a license requirement that we display the resulting downloaded .gif using a GPHMediaView instance? I'm assuming it is not, because the snippet example you sent me has an example that purportedly shows Glide being used with your url to load into a regular ImageView.

I'm having some issues with GPHMediaView (transparent backgrounds in the .gif, like in animated text for example, are still showing up as an actual checkerboard pattern, even though I have set the background of the GPHMediaView to transparent, and my settings has showCheckeredBackground set to FALSE - which I gather is just for how it displays in the fragmentDialog, not how it is actually rendered in GPHMediaView!).

I'd rather just use a standard ImageView and Glide to show the resulting .gif images which I already have working for other media file types.

I actually tried doing this with the url as specified for "original image" (ex url: https://media0.giphy.com/media/kOmZqTXVn2fVygF3Qx/giphy.gif?cid=821b1595ns7sn69s2wotkc11nzepvjxl39oj2b97c8tqduz9&rid=giphy.gif&ct=ts), and Glide errored out - it couldn't load it. Any idea why?

Thanks!

Tad

On Tue, Aug 17, 2021 at 8:05 AM ALexanderLonsky @.***> wrote:

@tfrysinger https://github.com/tfrysinger

The SDK provides only two solutions for the user interface - pre-built templates which handle the entirety of the GIPHY experience, and a Grid-Only implementation that allows for customization.

Other than that, you can use GPHCore to find gifs by id/ids and create a GPHMediaView to display the media.

It's not supposed to use GPHApiClient directly. The latest SDK versions are not obfuscated because our customers had some issues due to obfuscation, that is why now you can access GPHApiClient. I'll try to fix that in the next release.

If I want to actually download a .gif (not just give it to GPHMediaView to show) from within my Android app that the user has chosen through the fragment dialog, how do I do that?

GiphyDialogFragment.GifSelectionListener.onGifSelected provides a Media object.

To get an actual URL to a media file you can access it via:

media.images.original.gifUrl

or

media.images.original.webPUrl

media.images includes all the possible renditions, so you can pick any you'd like to use.

-- Please let me know if you have any other questions.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Giphy/giphy-android-sdk/issues/147#issuecomment-900328328, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYB4GCHQJ774I2ZQHRIJUTT5JUDLANCNFSM5CITGT6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

ALexanderLonsky commented 3 years ago

hey @tfrysinger,

thank you for the comprehensive reply, I'll take a look and get back to you.

ALexanderLonsky commented 3 years ago

@tfrysinger,

I’ve passed the request for adding more official Java documentation and code samples on to my team and can share any updates here in the future.

For now, I’ve attached a sample Java project which demonstrates a simple GIPHY SDK integration (we plan to add it to this repo later on).

Please see the two methods: public GiphyDialogFragment show and public void onGifSelected

to address your specific questions:

  1. How would you recommend programmatically downloading a .gif using that url - DownloadManager?

Yes, you can use DownloadManager. As an option, you can use Retrofit library. Also, there is another solution described here.

  1. Where is GPHCore documented? I see one Kotlin snippet:

There are only two functions to find gifs by id/ids, you can find both of them in the example project.

I think all of us really need these classes documented for Java users also!

Noted!

There are arguments that are optional in Kotlin and not optional

Thanks for catching this! We’ve fixed this for the GiphyDialogFragment.Companion.newInstance and Giphy.INSTANCE.configure, available in a new staging (maven("https://oss.sonatype.org/content/repositories/staging")) version: com.giphy.sdk:ui:2.1.5-alpha. (The attached project already points to this new version.)

Please check public GiphyDialogFragment show for reference.

WHEN do I need to verify the developer key?

In the new version, this param is now optional in Java as with Kotlin. There is a verification flow available under the web dashboard, however, it’s not required for production approval. You can ignore it.

Is it a license requirement that we display the resulting downloaded .gif using a GPHMediaView instance?

It’s not. Check useGifView in the project - it allows choosing between GPHMediaView and ImageView( using Glide) to render a media.

I'm having some issues with GPHMediaView

Please try gifView.setBackgroundVisible(false); which is shown in the attached project.

and Glide errored out - it couldn't load it. Any idea why?

It works well on my end, let us know if this is resolved in the attached example.

P.S. don't forget to replace INVALID_KEY with yours.

giphy_java_sample.zip

tfrysinger commented 3 years ago

Thanks much, will review and reply!

On Thu, Aug 19, 2021 at 3:15 AM ALexanderLonsky @.***> wrote:

@tfrysinger https://github.com/tfrysinger,

I’ve passed the request for adding more official Java documentation and code samples on to my team and can share any updates here in the future.

For now, I’ve attached a sample Java project which demonstrates a simple GIPHY SDK integration (we plan to add it to this repo later on).

Please see the two methods: public GiphyDialogFragment show and public void onGifSelected

to address your specific questions:

  1. How would you recommend programmatically downloading a .gif using that url - DownloadManager?

Yes, you can use DownloadManager. As an option, you can use Retrofit library. Also, there is another solution described here https://github.com/Giphy/giphy-android-sdk/issues/104#issuecomment-737376959 .

  1. Where is GPHCore documented? I see one Kotlin snippet:

There are only two functions to find gifs by id/ids, you can find both of them in the example project.

I think all of us really need these classes documented for Java users also!

Noted!

There are arguments that are optional in Kotlin and not optional

Thanks for catching this! We’ve fixed this for the GiphyDialogFragment.Companion.newInstance and Giphy.INSTANCE.configure, available in a new staging (maven(" https://oss.sonatype.org/content/repositories/staging")) version: com.giphy.sdk:ui:2.1.5-alpha. (The attached project already points to this new version.)

Please check public GiphyDialogFragment show for reference.

WHEN do I need to verify the developer key?

In the new version, this param is now optional in Java as with Kotlin. There is a verification flow available under the web dashboard, however, it’s not required for production approval. You can ignore it.

Is it a license requirement that we display the resulting downloaded .gif using a GPHMediaView instance?

It’s not. Check useGifView in the project - it allows choosing between GPHMediaView and ImageView( using Glide) to render a media.

I'm having some issues with GPHMediaView

Please try gifView.setBackgroundVisible(false); which is shown in the attached project.

and Glide errored out - it couldn't load it. Any idea why?

It works well on my end, let us know if this is resolved in the attached example.

P.S. don't forget to replace INVALID_KEY with yours.

giphy_java_sample.zip https://github.com/Giphy/giphy-android-sdk/files/7013188/giphy_java_sample.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Giphy/giphy-android-sdk/issues/147#issuecomment-901749518, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYB4GGSN7FANS6TGMXGRV3T5TDTZANCNFSM5CITGT6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

ALexanderLonsky commented 2 years ago

The SDK documentation updated:

Kotlin: https://github.com/Giphy/giphy-android-sdk/blob/main/Docs.md Java: https://github.com/Giphy/giphy-android-sdk/blob/main/Docs_Java.md

Java demo: https://github.com/Giphy/giphy-android-sdk/blob/main/app/src/main/java/com/giphy/sdk/uidemo/DemoActivityJava.java