From 607f1a61b7867a0864f89334ac016a8384903b6e Mon Sep 17 00:00:00 2001 From: Ivan Kopylov Date: Sun, 10 Oct 2021 16:56:32 +0300 Subject: [PATCH] Release v1.0 --- .gitignore | 15 ++ app/.gitignore | 1 + app/build.gradle | 47 +++++ app/proguard-rules.pro | 21 ++ .../sampleapp/ExampleInstrumentedTest.kt | 24 +++ app/src/main/AndroidManifest.xml | 23 +++ .../com/kopylovis/sampleapp/MainActivity.kt | 82 ++++++++ .../drawable-v24/ic_launcher_foreground.xml | 30 +++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ app/src/main/res/layout/activity_main.xml | 56 ++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 4216 bytes .../mipmap-hdpi/ic_launcher_adaptive_back.png | Bin 0 -> 5727 bytes .../mipmap-hdpi/ic_launcher_adaptive_fore.png | Bin 0 -> 6307 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2424 bytes .../mipmap-mdpi/ic_launcher_adaptive_back.png | Bin 0 -> 3076 bytes .../mipmap-mdpi/ic_launcher_adaptive_fore.png | Bin 0 -> 4288 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 6066 bytes .../ic_launcher_adaptive_back.png | Bin 0 -> 9128 bytes .../ic_launcher_adaptive_fore.png | Bin 0 -> 9810 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 10565 bytes .../ic_launcher_adaptive_back.png | Bin 0 -> 16453 bytes .../ic_launcher_adaptive_fore.png | Bin 0 -> 18740 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 15213 bytes .../ic_launcher_adaptive_back.png | Bin 0 -> 25159 bytes .../ic_launcher_adaptive_fore.png | Bin 0 -> 27853 bytes app/src/main/res/values-night/themes.xml | 16 ++ app/src/main/res/values/colors.xml | 12 ++ app/src/main/res/values/dimens.xml | 4 + app/src/main/res/values/strings.xml | 8 + app/src/main/res/values/themes.xml | 22 +++ .../kopylovis/sampleapp/ExampleUnitTest.kt | 17 ++ build.gradle | 18 ++ gradle.properties | 21 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 ++++++++++++++++++ gradlew.bat | 89 +++++++++ jitpack.yml | 4 + settings.gradle | 11 ++ toastmeister/.gitignore | 1 + toastmeister/build.gradle | 51 +++++ toastmeister/consumer-rules.pro | 0 toastmeister/proguard-rules.pro | 21 ++ .../toastmeister/ExampleInstrumentedTest.kt | 24 +++ toastmeister/src/main/AndroidManifest.xml | 5 + .../toastmeister/ContextExtensions.kt | 185 ++++++++++++++++++ .../kopylovis/toastmeister/ToastMeister.kt | 13 ++ .../res/drawable/ic_baseline_block_24.xml | 5 + .../drawable/ic_baseline_check_circle_24.xml | 5 + .../main/res/drawable/ic_baseline_info_24.xml | 5 + .../main/res/drawable/ic_baseline_soap_24.xml | 5 + .../res/drawable/ic_baseline_stars_24.xml | 5 + .../res/drawable/toastmeister_gradient.xml | 7 + .../res/layout/view_custom_toastmeister.xml | 54 +++++ toastmeister/src/main/res/values/colors.xml | 11 ++ .../kopylovis/toastmeister/ExampleUnitTest.kt | 17 ++ 57 files changed, 1301 insertions(+) create mode 100644 .gitignore create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/kopylovis/sampleapp/ExampleInstrumentedTest.kt create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/kopylovis/sampleapp/MainActivity.kt create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/test/java/com/kopylovis/sampleapp/ExampleUnitTest.kt create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 jitpack.yml create mode 100644 settings.gradle create mode 100644 toastmeister/.gitignore create mode 100644 toastmeister/build.gradle create mode 100644 toastmeister/consumer-rules.pro create mode 100644 toastmeister/proguard-rules.pro create mode 100644 toastmeister/src/androidTest/java/com/kopylovis/toastmeister/ExampleInstrumentedTest.kt create mode 100644 toastmeister/src/main/AndroidManifest.xml create mode 100644 toastmeister/src/main/java/com/kopylovis/toastmeister/ContextExtensions.kt create mode 100644 toastmeister/src/main/java/com/kopylovis/toastmeister/ToastMeister.kt create mode 100644 toastmeister/src/main/res/drawable/ic_baseline_block_24.xml create mode 100644 toastmeister/src/main/res/drawable/ic_baseline_check_circle_24.xml create mode 100644 toastmeister/src/main/res/drawable/ic_baseline_info_24.xml create mode 100644 toastmeister/src/main/res/drawable/ic_baseline_soap_24.xml create mode 100644 toastmeister/src/main/res/drawable/ic_baseline_stars_24.xml create mode 100644 toastmeister/src/main/res/drawable/toastmeister_gradient.xml create mode 100644 toastmeister/src/main/res/layout/view_custom_toastmeister.xml create mode 100644 toastmeister/src/main/res/values/colors.xml create mode 100644 toastmeister/src/test/java/com/kopylovis/toastmeister/ExampleUnitTest.kt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..48c8b4e --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,47 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdk 31 + + defaultConfig { + applicationId "com.kopylovis.sampleapp" + minSdk 24 + targetSdk 31 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + buildFeatures { + viewBinding true + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.6.0' + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.1' + implementation project(path: ':toastmeister') + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/kopylovis/sampleapp/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/kopylovis/sampleapp/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..c6ddcaf --- /dev/null +++ b/app/src/androidTest/java/com/kopylovis/sampleapp/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.kopylovis.sampleapp + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.kopylovis.sampleapp", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..fc7ac5b --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/kopylovis/sampleapp/MainActivity.kt b/app/src/main/java/com/kopylovis/sampleapp/MainActivity.kt new file mode 100644 index 0000000..5c9b184 --- /dev/null +++ b/app/src/main/java/com/kopylovis/sampleapp/MainActivity.kt @@ -0,0 +1,82 @@ +package com.kopylovis.sampleapp + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.View +import android.view.WindowManager +import androidx.core.content.ContextCompat +import com.kopylovis.sampleapp.databinding.ActivityMainBinding +import com.kopylovis.toastmeister.* + +class MainActivity : AppCompatActivity(), View.OnClickListener { + + private lateinit var binding: ActivityMainBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + window.setFlags( + WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, + WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS + ) + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) + setClickListeners() + } + + private fun setClickListeners() { + binding.apply { + amButtonNormalToast.setOnClickListener(this@MainActivity) + amButtonSuccessToast.setOnClickListener(this@MainActivity) + amButtonErrorToast.setOnClickListener(this@MainActivity) + amButtonInfoToast.setOnClickListener(this@MainActivity) + amButtonCustomToast.setOnClickListener(this@MainActivity) + } + } + + override fun onClick(v: View?) { + binding.apply { + when (v?.id) { + amButtonNormalToast.id -> this@MainActivity.normalToast( + NORMAL_TOAST, + ToastMeister.LENGTH_SHORT, + ToastMeister.GRAVITY_BOTTOM + ).show() + amButtonSuccessToast.id -> this@MainActivity.successToast( + R.string.toastmeister_lib_success_toast, + ToastMeister.LENGTH_MIDDLE, + ToastMeister.GRAVITY_TOP + ).show() + amButtonErrorToast.id -> this@MainActivity.errorToast( + R.string.toastmeister_lib_error_toast, + ToastMeister.LENGTH_LONG, + ToastMeister.GRAVITY_TOP + ).show() + amButtonInfoToast.id -> this@MainActivity.infoToast( + INFO_TOAST, + ToastMeister.LENGTH_SHORT, + ToastMeister.GRAVITY_BOTTOM + ).show() + amButtonCustomToast.id -> this@MainActivity.customToast( + CUSTOM_TOAST, + ToastMeister.LENGTH_SHORT, + ToastMeister.GRAVITY_TOP, + 150, + getColor(R.color.black), + 40, + getColor(R.color.toastmeister_green), + 18, + ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_baseline_soap_24), + getColor(R.color.colorPrimary), + 30, + 30 + ).show() + } + } + } + + companion object { + const val NORMAL_TOAST = "Normal Toast" + const val INFO_TOAST = "Info Toast" + const val CUSTOM_TOAST = "Custom toast" + } +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..c94c805 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,56 @@ + + + +