From dd5091056c8e85dc471f8951fcd10337ab465298 Mon Sep 17 00:00:00 2001 From: Alexander Lonsky Date: Mon, 25 Oct 2021 20:21:00 +0300 Subject: [PATCH] - update to SDK 2.1.9 --- Docs.md | 37 ++++++++++++++++++- app/build.gradle | 2 +- .../giphy/sdk/uidemo/DemoActivityJava.java | 1 - .../sdk/uidemo/SettingsDialogFragment.kt | 1 + 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Docs.md b/Docs.md index 47e2d3f..5df1933 100644 --- a/Docs.md +++ b/Docs.md @@ -12,7 +12,7 @@ The latest release is available on [Maven Central](https://search.maven.org/arti Add the GIPHY SDK dependency in the module ```build.gradle``` file: ``` -implementation 'com.giphy.sdk:ui:2.1.8' +implementation 'com.giphy.sdk:ui:2.1.9' ``` ### Basic Setup @@ -165,6 +165,41 @@ settings.theme = GPHTheme.Dark settings.setTheme(GPHTheme.Dark); ``` +As of version `2.1.9` you can set a custom theme +##### kotlin +# +```kotlin +GPHCustomTheme.channelColor= 0xffD8D8D8.toInt() +GPHCustomTheme.handleBarColor = 0xff888888.toInt() +GPHCustomTheme.backgroundColor = 0xff121212.toInt() +GPHCustomTheme.dialogOverlayBackgroundColor = 0xFF4E4E4E.toInt() +GPHCustomTheme.textColor = 0xffA6A6A6.toInt() +GPHCustomTheme.activeTextColor = 0xff00FF99.toInt() +GPHCustomTheme.imageColor = 0xC09A9A9A.toInt() +GPHCustomTheme.activeImageColor = 0xFF00FF99.toInt() +GPHCustomTheme.searchBackgroundColor = 0xFF4E4E4E.toInt() +GPHCustomTheme.searchQueryColor = 0xffffffff.toInt() +GPHCustomTheme.suggestionBackgroundColor = 0xFF212121.toInt() +GPHCustomTheme.moreByYouBackgroundColor = 0xFFF1F1F1.toInt() +GPHCustomTheme.backButtonColor = 0xFFFFFFFF.toInt() + +val settings = GPHSettings(theme = GPHTheme.Custom) +val dialog = GiphyDialogFragment.newInstance(settings) +dialog.show(supportFragmentManager, "gifs_dialog") +``` +##### java +# +```java +GPHCustomTheme.INSTANCE.setBackgroundColor(0xff121212); + +final GPHTheme theme = GPHTheme.Custom; +final GPHSettings settings = new GPHSettings(); +settings.setTheme(theme); +final GiphyDialogFragment dialog = GiphyDialogFragment.Companion.newInstance(settings); +dialog.show(getSupportFragmentManager(), "giphy_dialog"); +``` + + - **Media types**: Set the content type(s) you'd like to show by setting the `mediaTypeConfig` property, which is an array of `GPHContentType`s
**Note**: Emoji only is not available for the carousel layout option. ##### kotlin diff --git a/app/build.gradle b/app/build.gradle index 18839d6..869d515 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ dependencies { implementation "androidx.appcompat:appcompat:1.1.0" implementation "androidx.constraintlayout:constraintlayout:1.1.3" implementation "com.google.android.material:material:1.1.0" - implementation "com.giphy.sdk:ui:2.1.8" + implementation "com.giphy.sdk:ui:2.1.9" implementation 'com.github.bumptech.glide:glide:4.12.0' implementation "com.squareup.leakcanary:leakcanary-android:1.6.3" implementation "com.github.savvyapps:ToggleButtonLayout:1.2.0" diff --git a/app/src/main/java/com/giphy/sdk/uidemo/DemoActivityJava.java b/app/src/main/java/com/giphy/sdk/uidemo/DemoActivityJava.java index e8d85f27..d2b0793 100644 --- a/app/src/main/java/com/giphy/sdk/uidemo/DemoActivityJava.java +++ b/app/src/main/java/com/giphy/sdk/uidemo/DemoActivityJava.java @@ -109,7 +109,6 @@ public GiphyDialogFragment show(final boolean withDarkTheme, @NonNull final Gi settings.setSelectedContentType(GPHContentType.emoji); settings.setGridType(GridType.waterfall); - settings.setTheme(GPHTheme.Light); settings.setStickerColumnCount(3); final GiphyDialogFragment dialog = GiphyDialogFragment.Companion.newInstance(settings); dialog.setGifSelectionListener(listener); diff --git a/app/src/main/java/com/giphy/sdk/uidemo/SettingsDialogFragment.kt b/app/src/main/java/com/giphy/sdk/uidemo/SettingsDialogFragment.kt index 67025fe..a1ee62d 100644 --- a/app/src/main/java/com/giphy/sdk/uidemo/SettingsDialogFragment.kt +++ b/app/src/main/java/com/giphy/sdk/uidemo/SettingsDialogFragment.kt @@ -79,6 +79,7 @@ class SettingsDialogFragment : androidx.fragment.app.DialogFragment() { GPHTheme.Light -> R.id.lightTheme GPHTheme.Dark -> R.id.darkTheme GPHTheme.Automatic -> R.id.autoTheme + else -> R.id.autoTheme }, true ) layoutSelector.setToggled(