├── sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ ├── ic_airplanemode_inactive_black_24dp.xml │ │ │ │ └── ic_autorenew_black_24dp.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── muddzdev │ │ │ └── styleabletoast │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── muddzdev │ │ │ └── styleabletoast │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── muddzdev │ │ └── styleabletoast │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── styleabletoast ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── muddzdev │ │ │ │ └── styleabletoastlibrary │ │ │ │ ├── OnToastFinished.java │ │ │ │ ├── ToastDurationWatcher.java │ │ │ │ ├── Utils.java │ │ │ │ └── StyleableToast.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── muddzdev │ │ │ └── styleabletoastlibrary │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── muddzdev │ │ └── styleabletoastlibrary │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── showcase.png ├── sample app.apk ├── .idea ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /styleabletoast/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':styleabletoast' 2 | -------------------------------------------------------------------------------- /showcase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/showcase.png -------------------------------------------------------------------------------- /sample app.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/sample app.apk -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | StyleableToast 3 | 4 | -------------------------------------------------------------------------------- /styleabletoast/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | StyleableToastLibrary 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PDDStudio/StyleableToast/master/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /styleabletoast/src/main/java/com/muddzdev/styleabletoastlibrary/OnToastFinished.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoastlibrary; 2 | 3 | /** 4 | * Created by Muddz on 26-01-2017. 5 | */ 6 | 7 | public interface OnToastFinished { 8 | void onToastFinished(); 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 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-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #e24747 7 | #dadada 8 | 9 | -------------------------------------------------------------------------------- /styleabletoast/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /sample/src/test/java/com/muddzdev/styleabletoast/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoast; 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() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /styleabletoast/src/test/java/com/muddzdev/styleabletoastlibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoastlibrary; 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() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_airplanemode_inactive_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_autorenew_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /sample/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\Muddz\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 | -------------------------------------------------------------------------------- /styleabletoast/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\Muddz\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 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /sample/src/androidTest/java/com/muddzdev/styleabletoast/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoast; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.muddzdev.styleabletoast", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /styleabletoast/src/androidTest/java/com/muddzdev/styleabletoastlibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoastlibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.muddzdev.styleabletoastlibrary.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.muddzdev.styleabletoast" 8 | minSdkVersion 16 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.1.0' 28 | testCompile 'junit:junit:4.12' 29 | compile project(':styleabletoast') 30 | } 31 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /styleabletoast/src/main/java/com/muddzdev/styleabletoastlibrary/ToastDurationWatcher.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoastlibrary; 2 | 3 | import android.os.CountDownTimer; 4 | 5 | /** 6 | * Created by Muddz on 26-01-2017. 7 | */ 8 | 9 | public class ToastDurationWatcher { 10 | 11 | private static final int LENGTH_LONG = 3500; 12 | private static final int LENGTH_SHORT = 2000; 13 | private int duration; 14 | private OnToastFinished onToastFinished; 15 | 16 | 17 | public ToastDurationWatcher(int duration, OnToastFinished onToastFinished) { 18 | this.duration = duration; 19 | this.onToastFinished = onToastFinished; 20 | trackToastDuration(); 21 | } 22 | 23 | 24 | private void trackToastDuration() { 25 | CountDownTimer countDownTimer = new CountDownTimer(getToastDuration() + 500, 1000) { 26 | @Override 27 | public void onTick(long millisUntilFinished) { 28 | 29 | } 30 | 31 | @Override 32 | public void onFinish() { 33 | if (onToastFinished != null) { 34 | onToastFinished.onToastFinished(); 35 | } 36 | } 37 | }; 38 | countDownTimer.start(); 39 | } 40 | 41 | 42 | private long getToastDuration() { 43 | if (duration == 1) { 44 | return (long) LENGTH_LONG; 45 | } else { 46 | return (long) LENGTH_SHORT; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /styleabletoast/src/main/java/com/muddzdev/styleabletoastlibrary/Utils.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoastlibrary; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Color; 6 | import android.support.annotation.AttrRes; 7 | import android.util.TypedValue; 8 | 9 | /** 10 | * Created by Muddz on 26-01-2017. 11 | */ 12 | 13 | public class Utils { 14 | 15 | 16 | public static float getTypedValueInDP(Context context, float value) { 17 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, context.getResources().getDisplayMetrics()); 18 | } 19 | 20 | public static float getTypedValueInSP(Context context, float value) { 21 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, value, context.getResources().getDisplayMetrics()); 22 | } 23 | 24 | 25 | public static TypedArray getStyleValuesColor(Context context, @AttrRes int attrId, int style) { 26 | TypedArray a = null; 27 | int result; 28 | 29 | if (style > 0) { 30 | int[] AttrSet = {attrId}; 31 | a = context.obtainStyledAttributes(style, AttrSet); 32 | result = a.getColor(0, Color.LTGRAY); 33 | 34 | } 35 | return a; 36 | 37 | } 38 | 39 | public static int getStyleValuesInt(Context context, @AttrRes int attrId, int style) { 40 | TypedArray a = null; 41 | 42 | if (style > 0) { 43 | int[] AttrSet = {attrId}; 44 | a = context.obtainStyledAttributes(style, AttrSet); 45 | a.recycle(); 46 | } 47 | return a.getInt(0, 0); 48 | } 49 | 50 | public static String getStyleValuesString(Context context, @AttrRes int attrId, int style) { 51 | TypedArray a = null; 52 | 53 | if (style > 0) { 54 | int[] AttrSet = {attrId}; 55 | a = context.obtainStyledAttributes(style, AttrSet); 56 | a.recycle(); 57 | } 58 | return a.getString(0); 59 | } 60 | 61 | 62 | public static boolean getStyleValuesBoolean(Context context, @AttrRes int attrId, int style) { 63 | TypedArray a = null; 64 | 65 | if (style > 0) { 66 | int[] AttrSet = {attrId}; 67 | a = context.obtainStyledAttributes(style, AttrSet); 68 | a.recycle(); 69 | } 70 | return a.getBoolean(0, false); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /sample/src/main/java/com/muddzdev/styleabletoast/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.muddzdev.styleabletoast; 2 | 3 | import android.graphics.Color; 4 | import android.graphics.Typeface; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | import android.widget.Toast; 9 | 10 | import com.muddzdev.styleabletoastlibrary.StyleableToast; 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | StyleableToast st; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | 20 | } 21 | 22 | 23 | public void Toaster(View v) { 24 | 25 | switch (v.getId()) { 26 | case R.id.button1: 27 | 28 | st = new StyleableToast(this, "Updating profile", Toast.LENGTH_LONG); 29 | st.setBackgroundColor(Color.parseColor("#ff5a5f")); 30 | st.setTextColor(Color.WHITE); 31 | st.setIcon(R.drawable.ic_autorenew_black_24dp); 32 | st.spinIcon(); 33 | st.setMaxAlpha(); 34 | st.show(); 35 | 36 | break; 37 | 38 | case R.id.button2: 39 | 40 | 41 | st = new StyleableToast(this, "Turn off fly mode", Toast.LENGTH_LONG); 42 | st.setBackgroundColor(Color.parseColor("#865aff")); 43 | st.setTextColor(Color.WHITE); 44 | st.setIcon(R.drawable.ic_airplanemode_inactive_black_24dp); 45 | st.show(); 46 | 47 | break; 48 | 49 | case R.id.button3: 50 | 51 | 52 | st = new StyleableToast(this, "Profile saved", Toast.LENGTH_LONG); 53 | st.setBackgroundColor(Color.parseColor("#3b5998")); 54 | st.setMaxAlpha(); 55 | st.setTextFont(Typeface.createFromAsset(getAssets(), "fonts/dosis.otf")); 56 | st.show(); 57 | 58 | 59 | break; 60 | 61 | case R.id.button4: 62 | 63 | st = new StyleableToast(this.getApplicationContext(), "PHONE IS OVERHEATING!", Toast.LENGTH_LONG); 64 | st.setCornerRadius(5); 65 | st.setBackgroundColor(Color.BLACK); 66 | st.setTextColor(Color.RED); 67 | st.setBoldText(); 68 | st.show(); 69 | 70 | break; 71 | 72 | case R.id.button5: 73 | 74 | StyleableToast.makeText(this, "Picture saved in gallery", Toast.LENGTH_LONG, R.style.StyleableToast).show(); 75 | 76 | break; 77 | 78 | case R.id.button6: 79 | 80 | st = new StyleableToast(this, "Wrong password/username", Toast.LENGTH_LONG); 81 | st.setBackgroundColor(Color.parseColor("#2187c6")); 82 | st.setBoldText(); 83 | st.setTextColor(Color.WHITE); 84 | st.setCornerRadius(7); 85 | st.show(); 86 | break; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |