Created on Oct. 7th, 2017 by Matt Muehlemann
Add dependency to build.gradle of your app
dependencies {
implementation 'com.muehlemann:giphy:1.0.1'
}
Add the GiphyLibrary activity to your projects android manifest
<activity
android:name="com.muehlemann.giphy.GiphyActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
Create a GiphyLibrary object in your activity.
GiphyLibrary giphyLibrary = new GiphyLibrary();
To start the GiphyLibrary picker call:
giphyLibrary.start(context, listener, API_KEY);
Then delegate the onActivityResult to the GiphyLibrary object and implement the GiphyLibrary listener.
public class MainActivity implements GiphyLibrary.Listener {
...
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
giphyLibrary.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onGiphySelected(String url) {
Glide.with(MainActivity.this).load(url).into(imageView);
}
}
This project is licensed under the MIT License - see the LICENSE.md file for details