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

error resource style/ShapeAppearanceOverlay.DifferentCornerSize not found. #208

Closed VIkash2601 closed 1 year ago

VIkash2601 commented 1 year ago

🐛 Bug Report

I am unable to build the app after implementing the Giphy SDK and used it inside the fragment.

To Reproduce

Modify below Dependencies;

  1. implementation 'com.google.android.material:material:1.9.0'
  2. implementation 'androidx.appcompat:appcompat:1.5.0'
  3. implementation 'com.giphy.sdk:ui:2.3.8'

And then try to build the app.

(Write your steps here:)

  1. Make above changes and build the project.

Expected behavior

The app should build properly and on click of the button the Giphy Dialog should open.

Actual Behavior

Build failed with below error; Android resource linking failed error: resource style/ShapeAppearanceOverlay.DifferentCornerSize (aka com.app.spinnr.test:style/ShapeAppearanceOverlay.DifferentCornerSize) not found. image

Your Environment

Reproducible Demo

ALexanderLonsky commented 1 year ago

@VIkash2601 Hey, I've prepared a demo project where the Giphy dialog is invoked directly from the fragment. Replace YOUR_API_KEY with your actual key. Please let me know if there's anything else I can help with.

fragment_giphy_dialog.zip

VIkash2601 commented 1 year ago

Hi @ALexanderLonsky thank you for your reply. I will look into it. I have a case where I share the selected gif url to my server to save the chat history and get it in the API. And, currently I am able to render the gif as thumbnail in GPHMediaView but the gif does not play.

ALexanderLonsky commented 1 year ago

Have you successfully compiled your project and run the dialog? You might want to check out our demo project, which allows you to interact with the SDK. In it, you can select media from the dialog and then display it in a list. In your situation, consider sending the GIF's ID instead of its URL, then use the GPHCore.gifById(id) method. Additionally, here's a link to a similar issue that may help.

VIkash2601 commented 1 year ago

One last question before I close this thread, is it possible to get the GIF using media.<any url>?

ALexanderLonsky commented 1 year ago

take a look at this

VIkash2601 commented 1 year ago

Sorry that I was unable to explain my question properly as the solution suggested by you is to fetch the URL that I am achieving properly for my Use Case. The concern is if I have the gifUrl from the server, is it possible to set this to GPHMediaView, get the GIF media data from it, and play the GIF.

ALexanderLonsky commented 1 year ago

Usually, in the URL path, the /media is followed by the ID. You can parse this to retrieve the ID. However, I wouldn't recommend relying on this, and we don't provide mechanisms to pass the URL directly into GPHMediaView. Though, you can still use com.facebook.drawee.view.SimpleDraweeView, it should be something like this:

<com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/my_image_view"
...
binding.myImageView.controller = Fresco.newDraweeControllerBuilder().setImageRequest(ImageRequest.fromUri("url"))
            .setAutoPlayAnimations(true)
            .build()

Furthermore, you can use Glide to render GIFs by their URLs.