├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── 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 │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable │ │ │ │ ├── ic_normal.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ └── fragment_blank.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── ankushyerawar │ │ │ │ └── floatingsnackbar │ │ │ │ ├── MainActivity.java │ │ │ │ └── BlankFragment.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── ankushyerawar │ │ │ └── floatingsnackbar │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── ankushyerawar │ │ └── floatingsnackbar │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── floatingsnackbar ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── color.xml │ │ │ └── drawable │ │ │ │ ├── bg_info.xml │ │ │ │ ├── bg_success.xml │ │ │ │ ├── bg_warning.xml │ │ │ │ ├── bg_default.xml │ │ │ │ ├── bg_error.xml │ │ │ │ ├── ic_default.xml │ │ │ │ ├── ic_error.xml │ │ │ │ ├── ic_success.xml │ │ │ │ ├── ic_info.xml │ │ │ │ └── ic_custom.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── ankushyerwar │ │ │ └── floatingsnackbar │ │ │ ├── utils │ │ │ ├── Constants.java │ │ │ └── Type.java │ │ │ ├── definations │ │ │ ├── ColorInt.java │ │ │ ├── StringRes.java │ │ │ ├── DrawableRes.java │ │ │ └── Duration.java │ │ │ ├── SnackBar.java │ │ │ └── customization │ │ │ └── Customize.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── ankushyerwar │ │ │ └── floatingsnackbar │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── ankushyerwar │ │ └── floatingsnackbar │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── vcs.xml ├── misc.xml ├── runConfigurations.xml ├── gradle.xml ├── inspectionProfiles │ └── Project_Default.xml └── codeStyles │ └── Project.xml ├── .gitignore ├── LICENSE ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /floatingsnackbar/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':floatingsnackbar' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FloatingSnackbar 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8dp 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankushyerawar/FloatingSnackBar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /floatingsnackbar/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/bg_info.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/bg_success.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/bg_warning.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Floating SnackBar 3 | 4 | 5 | Hello blank fragment 6 | 7 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/bg_default.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/bg_error.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Dec 04 16:04:09 IST 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.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #D50000 4 | #3F51B5 5 | #388E3C 6 | #FFA900 7 | #353A3E 8 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/ic_default.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/ic_error.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_normal.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/ic_success.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/ic_info.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/test/java/com/ankushyerawar/floatingsnackbar/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerawar.floatingsnackbar; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /floatingsnackbar/src/test/java/com/ankushyerwar/floatingsnackbar/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /floatingsnackbar/src/main/java/com/ankushyerwar/floatingsnackbar/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar.utils; 2 | 3 | public class Constants { 4 | 5 | public static final int margin = 24; 6 | public static final int corner = 8; 7 | 8 | public static final int textSize = 16; 9 | public static final int maxLines = 2; 10 | 11 | public static final int noVal = 0; 12 | 13 | public static final boolean withIcon = true; 14 | public static final boolean withNoIcon = false; 15 | 16 | public static final String TAG = "SnackBar"; 17 | } 18 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/res/drawable/ic_custom.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/java/com/ankushyerwar/floatingsnackbar/definations/ColorInt.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar.definations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.FIELD; 7 | import static java.lang.annotation.ElementType.LOCAL_VARIABLE; 8 | import static java.lang.annotation.ElementType.METHOD; 9 | import static java.lang.annotation.ElementType.PARAMETER; 10 | import static java.lang.annotation.RetentionPolicy.CLASS; 11 | 12 | @Retention(CLASS) 13 | @Target({PARAMETER,METHOD,LOCAL_VARIABLE,FIELD}) 14 | public @interface ColorInt { 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/ankushyerawar/floatingsnackbar/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerawar.floatingsnackbar; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.os.Bundle; 6 | 7 | public class MainActivity extends AppCompatActivity { 8 | 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main); 13 | 14 | getSupportFragmentManager() 15 | .beginTransaction() 16 | .add(R.id.container,BlankFragment.newInstance()) 17 | .commit(); 18 | 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/java/com/ankushyerwar/floatingsnackbar/definations/StringRes.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar.definations; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.FIELD; 8 | import static java.lang.annotation.ElementType.LOCAL_VARIABLE; 9 | import static java.lang.annotation.ElementType.METHOD; 10 | import static java.lang.annotation.ElementType.PARAMETER; 11 | import static java.lang.annotation.RetentionPolicy.CLASS; 12 | 13 | @Documented 14 | @Retention(CLASS) 15 | @Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) 16 | public @interface StringRes { 17 | } 18 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/java/com/ankushyerwar/floatingsnackbar/definations/DrawableRes.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar.definations; 2 | 3 | import static java.lang.annotation.ElementType.FIELD; 4 | import static java.lang.annotation.ElementType.LOCAL_VARIABLE; 5 | import static java.lang.annotation.ElementType.METHOD; 6 | import static java.lang.annotation.ElementType.PARAMETER; 7 | import static java.lang.annotation.RetentionPolicy.CLASS; 8 | 9 | import java.lang.annotation.Documented; 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.Target; 12 | 13 | @Documented 14 | @Retention(CLASS) 15 | @Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) 16 | public @interface DrawableRes { 17 | } 18 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/java/com/ankushyerwar/floatingsnackbar/definations/Duration.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar.definations; 2 | 3 | import androidx.annotation.IntDef; 4 | import androidx.annotation.RestrictTo; 5 | 6 | import static com.ankushyerwar.floatingsnackbar.SnackBar.LENGTH_INDEFINITE; 7 | import static com.ankushyerwar.floatingsnackbar.SnackBar.LENGTH_SHORT; 8 | import static com.ankushyerwar.floatingsnackbar.SnackBar.LENGTH_LONG; 9 | 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.RetentionPolicy; 12 | 13 | @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 14 | @IntDef({LENGTH_INDEFINITE, LENGTH_SHORT, LENGTH_LONG}) 15 | @Retention(RetentionPolicy.SOURCE) 16 | public @interface Duration { 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/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 | -------------------------------------------------------------------------------- /floatingsnackbar/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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/ankushyerawar/floatingsnackbar/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerawar.floatingsnackbar; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.InstrumentationRegistry; 6 | import androidx.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getTargetContext(); 24 | 25 | assertEquals("com.rexaware.uppwd.snackbardemo", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /floatingsnackbar/src/androidTest/java/com/ankushyerwar/floatingsnackbar/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.InstrumentationRegistry; 6 | import androidx.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getTargetContext(); 24 | 25 | assertEquals("com.ankushyerwar.floatingsnackbar.test", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /floatingsnackbar/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.2" 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 21 10 | targetSdkVersion 29 11 | versionCode 3 12 | versionName "1.0.1" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | 30 | implementation 'androidx.appcompat:appcompat:1.1.0' 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'androidx.test:runner:1.2.0' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 34 | 35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 36 | 37 | implementation 'com.google.android.material:material:1.0.0' 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ankush Yerawar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /floatingsnackbar/src/main/java/com/ankushyerwar/floatingsnackbar/utils/Type.java: -------------------------------------------------------------------------------- 1 | package com.ankushyerwar.floatingsnackbar.utils; 2 | 3 | import android.graphics.Color; 4 | 5 | import com.ankushyerwar.floatingsnackbar.R; 6 | import com.ankushyerwar.floatingsnackbar.definations.DrawableRes; 7 | 8 | public enum Type { 9 | 10 | DEFAULT(R.drawable.ic_default, R.drawable.bg_default), 11 | SUCCESS(R.drawable.ic_success, R.drawable.bg_success), 12 | ERROR(R.drawable.ic_error, R.drawable.bg_error), 13 | WARNING(R.drawable.ic_info, R.drawable.bg_warning), 14 | INFO(R.drawable.ic_info, R.drawable.bg_info); 15 | 16 | private int iconResId; 17 | private int backResId; 18 | private int textColor = Color.WHITE; 19 | private int backColor = Color.DKGRAY; 20 | 21 | Type(@DrawableRes int iconResId, @DrawableRes int backResId) { 22 | this.iconResId = iconResId; 23 | this.backResId = backResId; 24 | } 25 | 26 | public int getBackColor() { 27 | return backColor; 28 | } 29 | 30 | public int getTextColor() { 31 | return textColor; 32 | } 33 | 34 | public int getIcon() { 35 | return iconResId; 36 | } 37 | 38 | public int getBackground() { 39 | return backResId; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | ext.versionMajor = 1 4 | ext.versionMinor = 0 5 | ext.versionPatch = 3 6 | ext.versionClassifier = null 7 | ext.isSnapshot = false 8 | ext.minimumSdkVersion = 21 9 | 10 | android { 11 | compileSdkVersion 29 12 | defaultConfig { 13 | applicationId "com.rexaware.uppwd.snackbardemo" 14 | minSdkVersion 21 15 | targetSdkVersion 29 16 | versionCode generateVersionCode() 17 | versionName generateVersionName() 18 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 19 | } 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | 27 | } 28 | 29 | private Integer generateVersionCode() { 30 | return ext.minimumSdkVersion * 10000000 + ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch 31 | } 32 | 33 | private String generateVersionName() { 34 | String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}" 35 | if (ext.versionClassifier == null && ext.isSnapshot) { 36 | ext.versionClassifier = "FloatingSnackbar" 37 | } 38 | 39 | if (ext.versionClassifier != null) { 40 | versionName += "-" + ext.versionClassifier 41 | } 42 | return versionName 43 | } 44 | 45 | dependencies { 46 | implementation fileTree(dir: 'libs', include: ['*.jar']) 47 | 48 | implementation 'androidx.appcompat:appcompat:1.2.0' 49 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 50 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 51 | testImplementation 'junit:junit:4.13' 52 | androidTestImplementation 'androidx.test:runner:1.2.0' 53 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 54 | implementation 'com.google.android.material:material:1.2.0' 55 | 56 | implementation project(":floatingsnackbar") 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![](https://jitpack.io/v/ankushyerawar/FloatingSnackBar.svg)](https://jitpack.io/#ankushyerawar/FloatingSnackBar) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 2 | # FloatingSnackBar 3 | Gmail Style Floating Snackbar with Custom Functionality. 4 | 5 | 6 | # Prerequisites 7 | 8 | Add this in your root `build.gradle` file (not your module `build.gradle` file) : 9 | 10 | allprojects { 11 | repositories { 12 | ... 13 | maven { url 'https://jitpack.io' } 14 | } 15 | } 16 | 17 | # Dependency 18 | 19 | Add this to your module's `build.gradle` file (make sure the version matches the JitPack badge above): 20 | 21 | dependencies { 22 | implementation 'com.google.android.material:material:1.2.0' 23 | implementation 'com.github.ankushyerawar:FloatingSnackBar:1.0.3' 24 | } 25 | 26 | # Versions 27 | 28 | **Version 0.1.0** 29 | 30 | First Release. 31 | 32 | **Version 1.0.0** 33 | 34 | Added a New Functionality to add icon to Normal Snackbar. 35 | 36 | **Version 1.0.1** 37 | 38 | Now you can change Icons of Default SnackBar Methods like success, error by passing Resource Id. 39 | 40 | **Version 1.0.2** 41 | 42 | Some small changes and Error handling. 43 | 44 | **Version 1.0.3** 45 | 46 | Now supports material design librery 1.1.0 and 1.2.0. 47 | All new featrue to support text RTL. 48 | 49 | # Sneak Peek 50 | 51 | ![device-2019-12-12-104334](https://user-images.githubusercontent.com/47925684/70686013-083a4300-1cd1-11ea-9f5f-84b03bbe1258.gif) 52 | 53 | # Usage 54 | 55 | Each method always returns a `Snackbar` object, so you can customize the `Snackbar` much more. **DON'T FORGET THE `show()` METHOD!** 56 | 57 | To display an error Snackbar: 58 | ``` 59 | SnackBar.error(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show(); 60 | ``` 61 | 62 | To display a success Snackbar: 63 | ``` 64 | SnackBar.success(view, R.string.app_name, SnackBar.LENGTH_LONG).show(); 65 | ``` 66 | 67 | To display an info Snackbar: 68 | ``` 69 | SnackBar.info(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show(); 70 | ``` 71 | 72 | To display a warning Snackbar: 73 | ``` 74 | SnackBar.warning(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show(); 75 | ``` 76 | To display the usual Snackbar: 77 | ``` 78 | SnackBar.normal(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show(); 79 | ``` 80 | To display the usual Snackbar with icon: 81 | ``` 82 | SnackBar.normal(getView(),"Snackbar with icon", SnackBar.LENGTH_LONG, R.drawable.ic_normal).show(); 83 | ``` 84 | You can also create your custom Snackbar with the custom() method: 85 | ``` 86 | SnackBar.custom(view, R.string.app_name, SnackBar.LENGTH_LONG,R.drawable.ic_custom, Color.DKGRAY, Color.WHITE,true).show(); 87 | ``` 88 | Here, This method also supports text rtl. 89 | 90 | # Extra 91 | 92 | **There are variants of each method, feel free to explore this library.** 93 | 94 | # Pull Request 95 | 96 | Have some new ideas or found a `bug`? Do not hesitate to open an `issue` and make a `pull request`. 97 | 98 | # License 99 | 100 | This library is under MIT License. See the [License](https://github.com/ankushyerawar/FloatingSnackBar/blob/master/LICENSE) file for more info. 101 | 102 | # Follow Me On 103 | 104 | 105 | Ankush Yerawar's DEV Profile 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_blank.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 |