├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── font │ │ ├── RobotoCondensed-Regular.ttf │ │ └── Slabo27px-Regular.ttf │ ├── java │ └── com │ │ └── irozon │ │ └── sneakersample │ │ ├── MainActivity.kt │ │ └── MainFragment.kt │ └── res │ ├── drawable │ ├── ic_no_connection.xml │ ├── round_background.xml │ └── user.jpg │ ├── layout-v21 │ └── custom_view.xml │ ├── layout │ ├── activity_main.xml │ ├── custom_view.xml │ └── fragment_main.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 │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── art └── Sneaker.png ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── sneaker ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── irozon │ └── sneaker │ ├── Sneaker.kt │ ├── SneakerView.kt │ ├── Utils.kt │ ├── interfaces │ ├── OnSneakerClickListener.kt │ └── OnSneakerDismissListener.kt │ └── widget │ └── RoundedImageView.java └── res ├── anim ├── popup_hide.xml └── popup_show.xml ├── drawable ├── ic_error.xml ├── ic_success.xml └── ic_warning.xml └── values ├── ids.xml └── strings.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # IntelliJ 36 | *.iml 37 | .idea 38 | .idea/workspace.xml 39 | .idea/tasks.xml 40 | .idea/gradle.xml 41 | .idea/assetWizardSettings.xml 42 | .idea/dictionaries 43 | .idea/libraries 44 | .idea/caches 45 | 46 | # Keystore files 47 | # Uncomment the following line if you do not want to check your keystore files in. 48 | #*.jks 49 | 50 | # External native build folder generated in Android Studio 2.2 and later 51 | .externalNativeBuild 52 | 53 | # Google Services (e.g. APIs or Firebase) 54 | google-services.json 55 | 56 | # Freeline 57 | freeline.py 58 | freeline/ 59 | freeline_project_description.json 60 | 61 | # fastlane 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | fastlane/readme.md 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sneaker v2 2 | A lightweight Android library for customizable alerts 3 | 4 | ![](https://github.com/Hamadakram/Sneaker/blob/master/art/Sneaker.png?raw=true) 5 | ## Download 6 | Grab via Gradle: 7 | ```kotlin 8 | implementation 'com.irozon.sneaker:sneaker:2.0.0' 9 | ``` 10 | ## Usage 11 | 12 | In Sneaker 2.0.0 it's possilbe to show sneaker on Activity, Fragment or any ViewGroup 13 | ```kotlin 14 | Sneaker.with(activity) // To show Sneaker on Activity 15 | Sneaker.with(fragment) // To show Sneaker on Fragment 16 | Sneaker.with(viewGroup) // To show Sneaker on ViewGroup 17 | ``` 18 | 19 | #### Custom: 20 | ```kotlin 21 | Sneaker.with(actvitiy) // Activity, Fragment or ViewGroup 22 | .setTitle("Title", R.color.white) // Title and title color 23 | .setMessage("This is the message.", R.color.white) // Message and message color 24 | .setDuration(4000) // Time duration to show 25 | .autoHide(true) // Auto hide Sneaker view 26 | .setHeight(ViewGroup.LayoutParams.WRAP_CONTENT) // Height of the Sneaker layout 27 | .setIcon(R.drawable.ic_no_connection, R.color.white, false) // Icon, icon tint color and circular icon view 28 | .setTypeface(Typeface.createFromAsset(this.getAssets(), "font/" + fontName)); // Custom font for title and message 29 | .setOnSneakerClickListener(this) // Click listener for Sneaker 30 | .setOnSneakerDismissListener(this) // Dismiss listener for Sneaker. - Version 1.0.2 31 | .setCornerRadius(radius, margin) // Radius and margin for round corner Sneaker. - Version 1.0.2 32 | .sneak(R.color.colorAccent) // Sneak with background color 33 | ``` 34 | #### Error: 35 | ```kotlin 36 | Sneaker.with(actvitiy) // Activity, Fragment or ViewGroup 37 | .setTitle("Error!!") 38 | .setMessage("This is the error message") 39 | .sneakError() 40 | ``` 41 | #### Success: 42 | ```kotlin 43 | Sneaker.with(actvitiy) // Activity, Fragment or ViewGroup 44 | .setTitle("Success!!") 45 | .setMessage("This is the success message") 46 | .sneakSuccess() 47 | ``` 48 | #### Warning: 49 | ```kotlin 50 | Sneaker.with(actvitiy) // Activity, Fragment or ViewGroup 51 | .setTitle("Warning!!") 52 | .setMessage("This is the warning message") 53 | .sneakWarning() 54 | ``` 55 | #### Custom View: 56 | ```kotlin 57 | val sneaker = Sneaker.with(actvitiy) // Activity, Fragment or ViewGroup 58 | val view = LayoutInflater.from(this).inflate(R.layout.custom_view, sneaker.getView(), false) 59 | // Your custom view code 60 | view.findViewById(R.id.tvInstall).setOnClickListener{ 61 | Toast.makeText(this, "Clicked", Toast.LENGTH_SHORT).show() 62 | } 63 | sneaker.sneakCustom(view) 64 | ``` 65 | ## Apps using Sneaker 66 | If you are using Sneaker in your app and would like to be listed here, please let me know by [email](mailto:hamadakram91@gmail.com) or opening a new issue! 67 | 68 | ## Authors 69 | 70 | * **Hammad Akram** - (https://github.com/hamadakram) 71 | 72 | ## Licence 73 | ``` 74 | Copyright 2018 Irozon, Inc. 75 | 76 | Licensed under the Apache License, Version 2.0 (the "License"); 77 | you may not use this file except in compliance with the License. 78 | You may obtain a copy of the License at 79 | 80 | http://www.apache.org/licenses/LICENSE-2.0 81 | 82 | Unless required by applicable law or agreed to in writing, software 83 | distributed under the License is distributed on an "AS IS" BASIS, 84 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 85 | See the License for the specific language governing permissions and 86 | limitations under the License. 87 | ``` 88 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 28 7 | buildToolsVersion "28.0.3" 8 | defaultConfig { 9 | applicationId "com.irozon.sneakersample" 10 | minSdkVersion 19 11 | targetSdkVersion 28 12 | versionCode 1 13 | versionName "1.0" 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | } 16 | buildTypes { 17 | release { 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | lintOptions { 22 | abortOnError false 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(include: ['*.jar'], dir: 'libs') 29 | 30 | implementation 'com.android.support:appcompat-v7:28.0.0' 31 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 32 | 33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 34 | 35 | //implementation project(':sneaker') 36 | implementation 'com.irozon.sneaker:sneaker:2.0.0' 37 | } 38 | repositories { 39 | mavenCentral() 40 | } 41 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\dell\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/assets/font/RobotoCondensed-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hamadakram/Sneaker/2776095aea85a8a3b018aa16fc3da7e08fb37e95/app/src/main/assets/font/RobotoCondensed-Regular.ttf -------------------------------------------------------------------------------- /app/src/main/assets/font/Slabo27px-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hamadakram/Sneaker/2776095aea85a8a3b018aa16fc3da7e08fb37e95/app/src/main/assets/font/Slabo27px-Regular.ttf -------------------------------------------------------------------------------- /app/src/main/java/com/irozon/sneakersample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.irozon.sneakersample 2 | 3 | import android.graphics.Typeface 4 | import android.os.Bundle 5 | import android.support.v7.app.AppCompatActivity 6 | import android.view.LayoutInflater 7 | import android.widget.TextView 8 | import android.widget.Toast 9 | import com.irozon.sneaker.Sneaker 10 | import com.irozon.sneaker.interfaces.OnSneakerDismissListener 11 | import kotlinx.android.synthetic.main.activity_main.* 12 | 13 | class MainActivity : AppCompatActivity() { 14 | 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | setContentView(R.layout.activity_main) 18 | 19 | with(supportFragmentManager.beginTransaction()) { 20 | this.add(R.id.fragment, MainFragment()) 21 | this.commit() 22 | } 23 | 24 | btShowError.setOnClickListener { 25 | Sneaker.with(this) 26 | .setTitle("Error!!") 27 | .setMessage("This is the error message") 28 | .setTypeface(Typeface.createFromAsset(this.assets, "font/Slabo27px-Regular.ttf")) 29 | .sneakError() 30 | } 31 | btShowSuccess.setOnClickListener { 32 | val sneaker = Sneaker.with(viewGroup) 33 | val view = LayoutInflater.from(this).inflate(R.layout.custom_view, sneaker.getView(), false) 34 | view.findViewById(R.id.tvInstall).setOnClickListener{ 35 | Toast.makeText(this, "Clicked", Toast.LENGTH_SHORT).show() 36 | } 37 | sneaker.sneakCustom(view) 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/irozon/sneakersample/MainFragment.kt: -------------------------------------------------------------------------------- 1 | package com.irozon.sneakersample 2 | 3 | import android.os.Bundle 4 | import android.support.v4.app.Fragment 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import com.irozon.sneaker.Sneaker 9 | import kotlinx.android.synthetic.main.fragment_main.* 10 | 11 | class MainFragment : Fragment() { 12 | override fun onCreateView( 13 | inflater: LayoutInflater, 14 | container: ViewGroup?, 15 | savedInstanceState: Bundle? 16 | ): View { 17 | return inflater.inflate(R.layout.fragment_main, container, false) 18 | } 19 | 20 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 21 | super.onViewCreated(view, savedInstanceState) 22 | 23 | btShowWarning.setOnClickListener { 24 | Sneaker.with(this) 25 | .setTitle("Warning!!") 26 | .setCornerRadius(5, 5) 27 | .setMessage("This is the warning message") 28 | .sneakWarning() 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_no_connection.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/round_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/user.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hamadakram/Sneaker/2776095aea85a8a3b018aa16fc3da7e08fb37e95/app/src/main/res/drawable/user.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout-v21/custom_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 18 | 29 | 30 | 40 | 41 | 42 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 26 | 27 |