├── sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── colors_material.xml │ │ ├── drawable │ │ │ ├── shadows.9.png │ │ │ ├── rounded_screen.xml │ │ │ └── ic_launcher_background.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── layout │ │ │ ├── activity_fluid_resize.xml │ │ │ └── activity_layout_visualizer.xml │ │ └── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ └── me │ │ │ └── saket │ │ │ └── fluidresize │ │ │ └── sample │ │ │ ├── App.kt │ │ │ ├── FluidResizeActivity.kt │ │ │ ├── Views.kt │ │ │ ├── FluidContentResizer.kt │ │ │ └── LayoutVisualizerActivity.kt │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── fluidresizelayout ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── me │ │ └── saket │ │ └── fluidresize │ │ ├── KeyboardVisibilityChanged.kt │ │ ├── internal │ │ └── Timber.kt │ │ ├── ActivityViewHolder.kt │ │ └── KeyboardVisibilityDetector.kt └── build.gradle ├── settings.gradle ├── images └── fluid_resize.gif ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── LICENSE ├── gradlew.bat └── gradlew /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /fluidresizelayout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':fluidresizelayout' 2 | -------------------------------------------------------------------------------- /images/fluid_resize.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/images/fluid_resize.gif -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true 3 | 4 | org.gradle.jvmargs=-Xmx1536m 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Fluid Resize 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/src/main/res/drawable/shadows.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/drawable/shadows.9.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /fluidresizelayout/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/FluidKeyboardResize/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable/rounded_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fluidresizelayout/src/main/java/me/saket/fluidresize/KeyboardVisibilityChanged.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize 2 | 3 | data class KeyboardVisibilityChanged( 4 | val visible: Boolean, 5 | val contentHeight: Int, 6 | val contentHeightBeforeResize: Int 7 | ) 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 14 14:20:31 EDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @color/gray_100 4 | @color/gray_300 5 | @color/teal_A400 6 | #EBF0F2 7 | 8 | -------------------------------------------------------------------------------- /sample/src/main/java/me/saket/fluidresize/sample/App.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize.sample 2 | 3 | import android.app.Application 4 | import timber.log.Timber 5 | import timber.log.Timber.DebugTree 6 | 7 | class App : Application() { 8 | 9 | override fun onCreate() { 10 | super.onCreate() 11 | Timber.plant(DebugTree()) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sample/src/main/java/me/saket/fluidresize/sample/FluidResizeActivity.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize.sample 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | 6 | class FluidResizeActivity : AppCompatActivity() { 7 | 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | setContentView(R.layout.activity_fluid_resize) 11 | 12 | FluidContentResizer.listen(this) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_fluid_resize.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | build/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio stuff 31 | .idea/ 32 | .navigation/ 33 | captures/ 34 | *.iml 35 | 36 | ### Android Patch ### 37 | gen-external-apklibs 38 | 39 | # OS specific ignores 40 | .DS_Store 41 | *~ 42 | *.swp 43 | -------------------------------------------------------------------------------- /fluidresizelayout/src/main/java/me/saket/fluidresize/internal/Timber.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize.internal 2 | 3 | import android.annotation.SuppressLint 4 | import android.util.Log 5 | import me.saket.fluidresize.BuildConfig 6 | 7 | /** This class exists because I keep typing Timber.i() everywhere. */ 8 | internal object Timber { 9 | 10 | @SuppressLint("LogNotTimber") 11 | fun i(message: String) { 12 | if (BuildConfig.DEBUG) { 13 | Log.i("IRV", message) 14 | } 15 | } 16 | 17 | @SuppressLint("LogNotTimber") 18 | fun w(message: String) { 19 | if (BuildConfig.DEBUG) { 20 | Log.w("IRV", message) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /fluidresizelayout/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$versions.dokka" 7 | } 8 | } 9 | 10 | apply plugin: 'com.android.library' 11 | apply plugin: 'kotlin-android' 12 | apply plugin: 'kotlin-kapt' 13 | apply plugin: 'org.jetbrains.dokka-android' 14 | 15 | android { 16 | compileSdkVersion versions.compileSdk 17 | resourcePrefix "fr_" 18 | 19 | defaultConfig { 20 | minSdkVersion 21 21 | targetSdkVersion versions.compileSdk 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin" 33 | } 34 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /sample/src/main/java/me/saket/fluidresize/sample/Views.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize.sample 2 | 3 | import android.content.res.Resources 4 | import android.view.View 5 | import android.view.ViewTreeObserver 6 | import timber.log.Timber 7 | 8 | /** 9 | * Run a function when a View gets measured and laid out on the screen. 10 | */ 11 | fun View.onNextMeasure(runnable: () -> Unit) { 12 | viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener { 13 | override fun onPreDraw(): Boolean { 14 | if (isLaidOut) { 15 | viewTreeObserver.removeOnPreDrawListener(this) 16 | runnable() 17 | 18 | } else if (visibility == View.GONE) { 19 | Timber.w("View's visibility is set to Gone. It'll never be measured: %s", resourceName()) 20 | viewTreeObserver.removeOnPreDrawListener(this) 21 | } 22 | return true 23 | } 24 | }) 25 | } 26 | 27 | fun View.resourceName(): String { 28 | var name = "" 29 | try { 30 | name = resources.getResourceEntryName(id) 31 | } catch (e: Resources.NotFoundException) { 32 | // Nothing to see here 33 | } 34 | return name 35 | } 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Fluid resize](https://github.com/saket/FluidResize/blob/master/images/fluid_resize.gif) 2 | 3 | Sample project for my blog post, [Smoothly reacting to keyboard visibility changes](https://saket.me/smoothly-reacting-to-keyboard/). 4 | 5 | The implementation for detecting keyboard visibility and animating size change can be found in [FluidContentResizer](https://github.com/saket/FluidKeyboardResize/blob/master/sample/src/main/java/me/saket/fluidresize/sample/FluidContentResizer.kt#L16) and its usage [here](https://github.com/saket/FluidKeyboardResize/blob/0d3c0e878b6652123e2a91e42d6cd4ecc9865b87/sample/src/main/java/me/saket/fluidresize/sample/FluidResizeActivity.kt#L14). It's a tiny project so feel free to simply copy over the necessary files to your project. 6 | 7 | ### License 8 | 9 | ``` 10 | This is free and unencumbered software released into the public domain. 11 | 12 | Anyone is free to copy, modify, publish, use, compile, sell, or 13 | distribute this software, either in source code form or as a compiled 14 | binary, for any purpose, commercial or non-commercial, and by any 15 | means. 16 | 17 | Full license can be read here: https://github.com/saket/FluidKeyboardResize/blob/master/LICENSE 18 | ``` 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | repositories { 7 | maven { url "https://jitpack.io" } 8 | } 9 | 10 | android { 11 | compileSdkVersion versions.compileSdk 12 | 13 | defaultConfig { 14 | applicationId "me.saket.fluidresize.sample" 15 | minSdkVersion versions.minSdk 16 | targetSdkVersion versions.compileSdk 17 | versionCode 1 18 | versionName "1.0" 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | 28 | compileOptions { 29 | targetCompatibility 1.8 30 | sourceCompatibility 1.8 31 | } 32 | } 33 | 34 | dependencies { 35 | implementation project(path: ':fluidresizelayout') 36 | 37 | implementation "androidx.appcompat:appcompat:$versions.androidx" 38 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin" 39 | 40 | implementation "com.jakewharton.timber:timber:$versions.timber" 41 | implementation('com.github.JakeWharton:kotterknife:e157638df1') { 42 | exclude group: 'com.android.support' 43 | } 44 | implementation 'io.reactivex.rxjava2:rxjava:2.1.9' 45 | implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' 46 | implementation "com.jakewharton.rxbinding2:rxbinding:$versions.rxBindings" 47 | implementation "com.jakewharton.rxrelay2:rxrelay:2.0.0" 48 | implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0' 49 | } 50 | -------------------------------------------------------------------------------- /fluidresizelayout/src/main/java/me/saket/fluidresize/ActivityViewHolder.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize 2 | 3 | import android.app.Activity 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import android.view.Window 7 | 8 | data class ActivityViewHolder( 9 | val nonResizableLayout: ViewGroup, 10 | val resizableLayout: ViewGroup, 11 | val contentView: ViewGroup 12 | ) { 13 | 14 | companion object { 15 | 16 | /** 17 | * The Activity View tree usually looks like this: 18 | * 19 | * DecorView <- does not get resized, contains space for system Ui bars. 20 | * - LinearLayout 21 | * -- FrameLayout <- gets resized 22 | * --- LinearLayout 23 | * ---- Activity content 24 | */ 25 | fun createFrom(activity: Activity): ActivityViewHolder { 26 | val decorView = activity.window.decorView as ViewGroup 27 | val contentView = decorView.findViewById(Window.ID_ANDROID_CONTENT) 28 | val actionBarRootLayout = contentView.parent as ViewGroup 29 | val resizableLayout = actionBarRootLayout.parent as ViewGroup 30 | 31 | return ActivityViewHolder( 32 | nonResizableLayout = decorView, 33 | resizableLayout = resizableLayout, 34 | contentView = contentView) 35 | } 36 | } 37 | 38 | fun onDetach(onDetach: () -> Unit) { 39 | nonResizableLayout.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener { 40 | override fun onViewDetachedFromWindow(v: View?) { 41 | onDetach() 42 | } 43 | 44 | override fun onViewAttachedToWindow(v: View?) {} 45 | }) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /fluidresizelayout/src/main/java/me/saket/fluidresize/KeyboardVisibilityDetector.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize 2 | 3 | import android.view.ViewTreeObserver 4 | 5 | object KeyboardVisibilityDetector { 6 | 7 | fun listen(viewHolder: ActivityViewHolder, listener: (KeyboardVisibilityChanged) -> Unit) { 8 | val detector = Detector(viewHolder, listener) 9 | viewHolder.nonResizableLayout.viewTreeObserver.addOnPreDrawListener(detector) 10 | viewHolder.onDetach { 11 | viewHolder.nonResizableLayout.viewTreeObserver.removeOnPreDrawListener(detector) 12 | } 13 | } 14 | 15 | private class Detector( 16 | val viewHolder: ActivityViewHolder, 17 | val listener: (KeyboardVisibilityChanged) -> Unit 18 | ) : ViewTreeObserver.OnPreDrawListener { 19 | 20 | private var previousHeight: Int = -1 21 | 22 | override fun onPreDraw(): Boolean { 23 | val detected = detect() 24 | 25 | // The layout flickers for a moment, usually on the first 26 | // animation. Intercepting this pre-draw seems to solve the problem. 27 | return detected.not() 28 | } 29 | 30 | private fun detect(): Boolean { 31 | val contentHeight = viewHolder.resizableLayout.height 32 | if (contentHeight == previousHeight) { 33 | return false 34 | } 35 | 36 | if (previousHeight != -1) { 37 | val statusBarHeight = viewHolder.resizableLayout.top 38 | val isKeyboardVisible = contentHeight < viewHolder.nonResizableLayout.height - statusBarHeight 39 | 40 | listener(KeyboardVisibilityChanged( 41 | visible = isKeyboardVisible, 42 | contentHeight = contentHeight, 43 | contentHeightBeforeResize = previousHeight)) 44 | } 45 | 46 | previousHeight = contentHeight 47 | return true 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /sample/src/main/java/me/saket/fluidresize/sample/FluidContentResizer.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize.sample 2 | 3 | import android.animation.ObjectAnimator 4 | import android.animation.ValueAnimator 5 | import android.app.Activity 6 | import android.view.View 7 | import androidx.interpolator.view.animation.FastOutSlowInInterpolator 8 | import me.saket.fluidresize.ActivityViewHolder 9 | import me.saket.fluidresize.KeyboardVisibilityChanged 10 | import me.saket.fluidresize.KeyboardVisibilityDetector 11 | 12 | object FluidContentResizer { 13 | 14 | private var heightAnimator: ValueAnimator = ObjectAnimator() 15 | 16 | fun listen(activity: Activity) { 17 | val viewHolder = ActivityViewHolder.createFrom(activity) 18 | 19 | KeyboardVisibilityDetector.listen(viewHolder) { 20 | animateHeight(viewHolder, it) 21 | } 22 | viewHolder.onDetach { 23 | heightAnimator.cancel() 24 | heightAnimator.removeAllUpdateListeners() 25 | } 26 | } 27 | 28 | private fun animateHeight(viewHolder: ActivityViewHolder, event: KeyboardVisibilityChanged) { 29 | val contentView = viewHolder.contentView 30 | contentView.setHeight(event.contentHeightBeforeResize) 31 | 32 | heightAnimator.cancel() 33 | 34 | // Warning: animating height might not be very performant. Try turning on 35 | // "Profile GPI rendering" in developer options and check if the bars stay 36 | // under 16ms in your app. Using Transitions API would be more efficient, but 37 | // for some reason it skips the first animation and I cannot figure out why. 38 | heightAnimator = ObjectAnimator.ofInt(event.contentHeightBeforeResize, event.contentHeight).apply { 39 | interpolator = FastOutSlowInInterpolator() 40 | duration = 300 41 | } 42 | heightAnimator.addUpdateListener { contentView.setHeight(it.animatedValue as Int) } 43 | heightAnimator.start() 44 | } 45 | 46 | private fun View.setHeight(height: Int) { 47 | val params = layoutParams 48 | params.height = height 49 | layoutParams = params 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /sample/src/main/java/me/saket/fluidresize/sample/LayoutVisualizerActivity.kt: -------------------------------------------------------------------------------- 1 | package me.saket.fluidresize.sample 2 | 3 | import android.animation.ObjectAnimator 4 | import android.annotation.SuppressLint 5 | import android.content.res.Resources 6 | import android.os.Bundle 7 | import android.util.DisplayMetrics 8 | import android.view.View 9 | import android.view.ViewGroup 10 | import androidx.appcompat.app.AppCompatActivity 11 | import androidx.interpolator.view.animation.FastOutSlowInInterpolator 12 | import com.jakewharton.rxbinding2.view.RxView 13 | import io.reactivex.android.schedulers.AndroidSchedulers.mainThread 14 | import io.reactivex.subjects.PublishSubject 15 | import kotterknife.bindView 16 | 17 | @SuppressLint("CheckResult") 18 | class LayoutVisualizerActivity : AppCompatActivity() { 19 | 20 | private val contentView by bindView(R.id.contentview) 21 | private val keyboardView by bindView(R.id.keyboard) 22 | 23 | private val onDestroy = PublishSubject.create() 24 | private val contentAnimDuration = 300L 25 | private val contentAnimDelay = 400L 26 | 27 | override fun onCreate(savedInstanceState: Bundle?) { 28 | super.onCreate(savedInstanceState) 29 | setContentView(R.layout.activity_layout_visualizer) 30 | 31 | RxView.clicks(contentView) 32 | .observeOn(mainThread()) 33 | .takeUntil(onDestroy) 34 | .scan(false) { keyboardVisible, _ -> keyboardVisible.not() } 35 | .subscribe { show -> 36 | if (show) { 37 | showKeyboard(smoothly = true) 38 | } else { 39 | hideKeyboard(smoothly = true) 40 | } 41 | } 42 | } 43 | 44 | override fun onDestroy() { 45 | onDestroy.onNext(Any()) 46 | super.onDestroy() 47 | } 48 | 49 | private fun showKeyboard(smoothly: Boolean = true) { 50 | val params = contentView.layoutParams as ViewGroup.MarginLayoutParams 51 | if (smoothly) { 52 | animateContentHeight(params, 150.dp) 53 | } else { 54 | params.bottomMargin = 150.dp 55 | contentView.layoutParams = params 56 | } 57 | 58 | keyboardView.visibility = View.VISIBLE 59 | keyboardView.alpha = 0F 60 | keyboardView.onNextMeasure { 61 | keyboardView.translationY = keyboardView.height / 4F 62 | } 63 | 64 | keyboardView.animate() 65 | .alpha(1F) 66 | .translationY(0F) 67 | .setInterpolator(FastOutSlowInInterpolator()) 68 | .start() 69 | } 70 | 71 | private fun hideKeyboard(smoothly: Boolean = true) { 72 | val params = contentView.layoutParams as ViewGroup.MarginLayoutParams 73 | 74 | if (smoothly) { 75 | animateContentHeight(params, 24.dp) 76 | } else { 77 | params.bottomMargin = 24.dp 78 | contentView.layoutParams = params 79 | } 80 | 81 | keyboardView.animate() 82 | .alpha(0F) 83 | .translationY(keyboardView.height / 4F) 84 | .setInterpolator(FastOutSlowInInterpolator()) 85 | .withEndAction { keyboardView.visibility = View.GONE } 86 | .start() 87 | } 88 | 89 | private fun animateContentHeight(params: ViewGroup.MarginLayoutParams, targetMargin: Int) { 90 | val paramsAnimator = ObjectAnimator.ofInt(params.bottomMargin, targetMargin).apply { 91 | duration = contentAnimDuration 92 | interpolator = FastOutSlowInInterpolator() 93 | startDelay = contentAnimDelay 94 | } 95 | paramsAnimator.addUpdateListener { 96 | params.bottomMargin = it.animatedValue as Int 97 | contentView.layoutParams = params 98 | } 99 | paramsAnimator.start() 100 | } 101 | } 102 | 103 | private val Number.dp: Int 104 | get() { 105 | val metrics = Resources.getSystem().displayMetrics 106 | return (this.toInt() * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)).toInt() 107 | } 108 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_layout_visualizer.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 22 | 23 | 38 | 39 | 48 | 49 | 53 | 54 | 58 | 59 | 63 | 64 | 65 | 74 | 75 | 83 | 84 | 96 | 97 | 105 | 106 | 110 | 111 | 119 | 120 | 124 | 125 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 25 | 26 | @android:color/transparent 27 | #06FFFFFF 28 | #0CFFFFFF 29 | #33FFFFFF 30 | #4CFFFFFF 31 | #66FFFFFF 32 | #80FFFFFF 33 | #99FFFFFF 34 | #CCFFFFFF 35 | #E6FFFFFF 36 | 37 | #0C000000 38 | #1A000000 39 | #33000000 40 | #4C000000 41 | #66000000 42 | #80000000 43 | #99000000 44 | #C4000000 45 | #E6000000 46 | 47 | 48 | #FFEBEE 49 | #FFCDD2 50 | #EF9A9A 51 | #E57373 52 | #EF5350 53 | #F44336 54 | #E53935 55 | #D32F2F 56 | #C62828 57 | #B71C1C 58 | #FF8A80 59 | #FF5252 60 | #FF1744 61 | #D50000 62 | 63 | 64 | #FCE4EC 65 | #F8BBD0 66 | #F48FB1 67 | #F06292 68 | #EC407A 69 | #E91E63 70 | #D81B60 71 | #C2185B 72 | #AD1457 73 | #880E4F 74 | #FF80AB 75 | #FF4081 76 | #F50057 77 | #C51162 78 | 79 | #F040FB 80 | 81 | 82 | #F3E5F5 83 | #E1BEE7 84 | #CE93D8 85 | #BA68C8 86 | #AB47BC 87 | #9C27B0 88 | #8E24AA 89 | #7B1FA2 90 | #6A1B9A 91 | #4A148C 92 | #EA80FC 93 | #E040FB 94 | #D500F9 95 | #AA00FF 96 | 97 | 98 | #EDE7F6 99 | #D1C4E9 100 | #B39DDB 101 | #9575CD 102 | #7E57C2 103 | #673AB7 104 | #5E35B1 105 | #512DA8 106 | #4527A0 107 | #311B92 108 | #B388FF 109 | #7C4DFF 110 | #651FFF 111 | #6200EA 112 | 113 | 114 | #E8EAF6 115 | #C5CAE9 116 | #9FA8DA 117 | #7986CB 118 | #5C6BC0 119 | #3F51B5 120 | #3949AB 121 | #303F9F 122 | #283593 123 | #1A237E 124 | #8C9EFF 125 | #536DFE 126 | #3D5AFE 127 | #304FFE 128 | 129 | 130 | #E3F2FD 131 | #BBDEFB 132 | #90CAF9 133 | #64B5F6 134 | #42A5F5 135 | #2196F3 136 | #1E88E5 137 | #1976D2 138 | #1565C0 139 | #0D47A1 140 | #82B1FF 141 | #448AFF 142 | #2979FF 143 | #2962FF 144 | 145 | 146 | #E1F5FE 147 | #B3E5FC 148 | #81D4fA 149 | #4fC3F7 150 | #29B6FC 151 | #03A9F4 152 | #039BE5 153 | #0288D1 154 | #0277BD 155 | #01579B 156 | #80D8FF 157 | #40C4FF 158 | #00B0FF 159 | #0091EA 160 | 161 | 162 | #E0F7FA 163 | #B2EBF2 164 | #80DEEA 165 | #4DD0E1 166 | #26C6DA 167 | #00BCD4 168 | #00ACC1 169 | #0097A7 170 | #00838F 171 | #006064 172 | #84FFFF 173 | #18FFFF 174 | #00E5FF 175 | #00B8D4 176 | 177 | 178 | #E0F2F1 179 | #B2DFDB 180 | #80CBC4 181 | #4DB6AC 182 | #26A69A 183 | #009688 184 | #00897B 185 | #00796B 186 | #00695C 187 | #004D40 188 | #A7FFEB 189 | #64FFDA 190 | #1DE9B6 191 | #00BFA5 192 | 193 | #00A394 194 | 195 | #11DAB1 196 | #28C9AA 197 | 198 | 199 | #E8F5E9 200 | #C8E6C9 201 | #A5D6A7 202 | #81C784 203 | #66BB6A 204 | #4CAF50 205 | #43A047 206 | #388E3C 207 | #2E7D32 208 | #1B5E20 209 | #B9F6CA 210 | #69F0AE 211 | #00E676 212 | #00C853 213 | 214 | 215 | #F1F8E9 216 | #DCEDC8 217 | #C5E1A5 218 | #AED581 219 | #9CCC65 220 | #8BC34A 221 | #7CB342 222 | #689F38 223 | #558B2F 224 | #33691E 225 | #CCFF90 226 | #B2FF59 227 | #76FF03 228 | #64DD17 229 | 230 | 231 | #F9FBE7 232 | #F0F4C3 233 | #E6EE9C 234 | #DCE775 235 | #D4E157 236 | #CDDC39 237 | #C0CA33 238 | #A4B42B 239 | #9E9D24 240 | #827717 241 | #F4FF81 242 | #EEFF41 243 | #C6FF00 244 | #AEEA00 245 | 246 | 247 | #FFFDE7 248 | #FFF9C4 249 | #FFF590 250 | #FFF176 251 | #FFEE58 252 | #FFEB3B 253 | #FDD835 254 | #FBC02D 255 | #F9A825 256 | #F57F17 257 | #FFFF82 258 | #FFFF00 259 | #FFEA00 260 | #FFD600 261 | 262 | 263 | #FFF8E1 264 | #FFECB3 265 | #FFE082 266 | #FFD54F 267 | #FFCA28 268 | #FFC107 269 | #FFB300 270 | #FFA000 271 | #FF8F00 272 | #FF6F00 273 | #FFE57F 274 | #FFD740 275 | #FFC400 276 | #FFAB00 277 | 278 | 279 | #FFF3E0 280 | #FFE0B2 281 | #FFCC80 282 | #FFB74D 283 | #FFA726 284 | #FF9800 285 | #FB8C00 286 | #F57C00 287 | #EF6C00 288 | #E65100 289 | #FFD180 290 | #FFAB40 291 | #FF9100 292 | #FF6D00 293 | 294 | 295 | #FBE9A7 296 | #FFCCBC 297 | #FFAB91 298 | #FF8A65 299 | #FF7043 300 | #FF5722 301 | #F4511E 302 | #E64A19 303 | #D84315 304 | #BF360C 305 | #FF9E80 306 | #FF6E40 307 | #FF3D00 308 | #DD2600 309 | 310 | 311 | #EFEBE9 312 | #D7CCC8 313 | #BCAAA4 314 | #A1887F 315 | #8D6E63 316 | #795548 317 | #6D4C41 318 | #5D4037 319 | #4E342E 320 | #3E2723 321 | 322 | 323 | #FAFAFA 324 | #F5F5F5 325 | #EEEEEE 326 | #E0E0E0 327 | #BDBDBD 328 | #9E9E9E 329 | #757575 330 | #616161 331 | #424242 332 | #3A3A3A 333 | #212121 334 | #1B1B1B 335 | #000000 336 | #ffffff 337 | 338 | 339 | #ECEFF1 340 | #CFD8DC 341 | #B0BBC5 342 | #90A4AE 343 | #78909C 344 | #607D8B 345 | #546E7A 346 | #455A64 347 | #37474F 348 | #263238 349 | #192126 350 | 351 | #15212D 352 | #1f2d3b 353 | #1F3143 354 | #294159 355 | 356 | --------------------------------------------------------------------------------