? =
+ defaultPreference.getStringSet(key, defaultValue)
+
+ fun remove(key: String): Boolean = defaultPreference.remove(key)
+
+ fun clear(): Boolean = defaultPreference.clear()
+ }
+}
+
+val Context.defaultPreference: Prefs
+ get() = Prefs.fromDefault()
+
+fun stringPreference(key: String, defaultValue: String? = null, prefs: Prefs = Prefs.fromDefault()): ReadWriteProperty
=
+ object : ReadWriteProperty
{
+ override fun getValue(thisRef: P, property: KProperty<*>): String? =
+ prefs.getString(key, defaultValue)
+
+ override fun setValue(thisRef: P, property: KProperty<*>, value: String?) {
+ prefs[key] = value
+ }
+ }
+
+fun
intPreference(key: String, defaultValue: Int = 0, prefs: Prefs = Prefs.fromDefault()): ReadWriteProperty
=
+ object : ReadWriteProperty
{
+ override fun getValue(thisRef: P, property: KProperty<*>): Int =
+ prefs.getInt(key, defaultValue)
+
+ override fun setValue(thisRef: P, property: KProperty<*>, value: Int) {
+ prefs[key] = value
+ }
+ }
+
+fun
booleanPreference(key: String, defaultValue: Boolean = false, prefs: Prefs = Prefs.fromDefault()): ReadWriteProperty
=
+ object : ReadWriteProperty
{
+ override fun getValue(thisRef: P, property: KProperty<*>): Boolean =
+ prefs.getBoolean(key, defaultValue)
+
+ override fun setValue(thisRef: P, property: KProperty<*>, value: Boolean) {
+ prefs[key] = value
+ }
+ }
+
+fun
floatPreference(key: String, defaultValue: Float = 0f, prefs: Prefs = Prefs.fromDefault()): ReadWriteProperty
=
+ object : ReadWriteProperty
{
+ override fun getValue(thisRef: P, property: KProperty<*>): Float =
+ prefs.getFloat(key, defaultValue)
+
+ override fun setValue(thisRef: P, property: KProperty<*>, value: Float) {
+ prefs[key] = value
+ }
+ }
+
+fun
longPreference(key: String, defaultValue: Long = 0L, prefs: Prefs = Prefs.fromDefault()): ReadWriteProperty
=
+ object : ReadWriteProperty
{
+ override fun getValue(thisRef: P, property: KProperty<*>): Long =
+ prefs.getLong(key, defaultValue)
+
+ override fun setValue(thisRef: P, property: KProperty<*>, value: Long) {
+ prefs[key] = value
+ }
+ }
diff --git a/lilypref/src/main/res/values/strings.xml b/lilypref/src/main/res/values/strings.xml
new file mode 100644
index 0000000..df43aa5
--- /dev/null
+++ b/lilypref/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ lilypref
+
diff --git a/lilypref/src/test/java/me/tuple/lily/ExampleUnitTest.java b/lilypref/src/test/java/me/tuple/lily/ExampleUnitTest.java
new file mode 100644
index 0000000..3b49356
--- /dev/null
+++ b/lilypref/src/test/java/me/tuple/lily/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package me.tuple.lily;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/lilytoast/.gitignore b/lilytoast/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/lilytoast/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/lilytoast/build.gradle b/lilytoast/build.gradle
new file mode 100644
index 0000000..469ed2f
--- /dev/null
+++ b/lilytoast/build.gradle
@@ -0,0 +1,42 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'com.github.dcendents.android-maven'
+
+group='com.github.VRGsoftUA'
+
+android {
+ compileSdkVersion rootProject.ext.complie_sdk_version
+
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion rootProject.ext.target_sdk_version
+ versionCode rootProject.ext.version_code
+ versionName rootProject.ext.version_name
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestImplementation(Libs.espresso_core)
+ implementation Libs.appcompat
+ implementation Libs.cardview
+ implementation Libs.material
+
+ testImplementation Libs.junit
+ implementation Libs.kotlin_stdlib_jdk7
+ implementation Libs.kotlin_reflect
+// implementation 'com.github.Gokuldroid.Lily:lilycore:master-SNAPSHOT'
+ implementation project(':lilycore')
+}
+repositories {
+ mavenCentral()
+}
diff --git a/lilytoast/proguard-rules.pro b/lilytoast/proguard-rules.pro
new file mode 100644
index 0000000..418646a
--- /dev/null
+++ b/lilytoast/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in E:\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# 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
diff --git a/lilytoast/src/androidTest/java/me/tuple/lily/ExampleInstrumentedTest.java b/lilytoast/src/androidTest/java/me/tuple/lily/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..2d4fcfe
--- /dev/null
+++ b/lilytoast/src/androidTest/java/me/tuple/lily/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package me.tuple.lily;
+
+import android.content.Context;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("me.tuple.lilytoast.test", appContext.getPackageName());
+ }
+}
diff --git a/lilytoast/src/main/AndroidManifest.xml b/lilytoast/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..c1cca43
--- /dev/null
+++ b/lilytoast/src/main/AndroidManifest.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/lilytoast/src/main/java/me/tuple/lily/toast/Snacky.kt b/lilytoast/src/main/java/me/tuple/lily/toast/Snacky.kt
new file mode 100644
index 0000000..371ea07
--- /dev/null
+++ b/lilytoast/src/main/java/me/tuple/lily/toast/Snacky.kt
@@ -0,0 +1,279 @@
+package me.tuple.lily.toast
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Color
+import android.graphics.Typeface
+import androidx.annotation.ColorInt
+import androidx.annotation.ColorRes
+import androidx.annotation.DrawableRes
+import androidx.annotation.StringRes
+import android.util.AttributeSet
+import android.view.Gravity
+import android.view.ViewGroup
+import android.view.animation.Animation
+import android.view.animation.AnimationUtils
+import android.widget.ImageView
+import android.widget.LinearLayout
+import android.widget.TextView
+import me.tuple.lily.R
+import me.tuple.lily.core.*
+import me.tuple.lily.utils.FontCache
+
+
+/**
+ * Created by LazyLoop.
+ */
+
+class Snacky : LinearLayout {
+ private var activity: Activity
+
+ constructor(activity: Activity) : this(activity, null)
+
+ private constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
+ private constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
+ this.activity = context as Activity
+ inflate(context, R.layout.snacky_layout, this)
+ }
+
+ private var icon: Int? = null
+ private var background: Int? = null
+ private var title: String? = null
+ private var message: String? = null
+ private var action: String? = null
+ private var titleColor: Int? = null
+ private var messageColor: Int? = null
+ private var actionColor: Int? = null
+ private var typeFace: Typeface? = null
+ private var layoutGravity: Int = Gravity.BOTTOM
+
+ private val iconView by bind(R.id.snacky_icon)
+ private val titleView by bind(R.id.snacky_title)
+ private val messageView by bind(R.id.snacky_message)
+ private val actionView by bind(R.id.snacky_action)
+ private val snackyView by bind(R.id.snacky)
+
+ fun title(@StringRes title: Int): Snacky {
+ title(context.getString(title))
+ return this
+ }
+
+ fun title(title: String): Snacky {
+ this.title = title
+ return this
+ }
+
+ fun message(@StringRes message: Int): Snacky {
+ message(context.getString(message))
+ return this
+ }
+
+ fun message(message: String): Snacky {
+ this.message = message
+ return this
+ }
+
+ fun action(@StringRes action: Int): Snacky {
+ action(context.getString(action))
+ return this
+ }
+
+ fun action(action: String): Snacky {
+ this.action = action
+ return this
+ }
+
+ fun icon(@DrawableRes icon: Int): Snacky {
+ this.icon = icon
+ return this
+ }
+
+ fun backgroundRes(@ColorRes bg: Int): Snacky {
+ this.background = Contexter.getColor(bg)
+ return this
+ }
+
+ fun background(@ColorInt bg: Int): Snacky {
+ this.background = bg
+ return this
+ }
+
+
+ fun titleColorRes(@ColorRes bg: Int): Snacky {
+ this.titleColor = Contexter.getColor(bg)
+ return this
+ }
+
+ fun titleColor(@ColorInt bg: Int): Snacky {
+ this.titleColor = bg
+ return this
+ }
+
+ fun messageColorRes(@ColorRes bg: Int): Snacky {
+ this.messageColor = Contexter.getColor(bg)
+ return this
+ }
+
+ fun messageColor(@ColorInt bg: Int): Snacky {
+ this.messageColor = bg
+ return this
+ }
+
+ fun actionColorRes(@ColorRes bg: Int): Snacky {
+ this.actionColor = Contexter.getColor(bg)
+ return this
+ }
+
+ fun actionColor(@ColorInt bg: Int): Snacky {
+ this.actionColor = bg
+ return this
+ }
+
+ fun font(fontName: String): Snacky {
+ this.typeFace = FontCache.getFont(fontName)
+ return this
+ }
+
+ fun font(typeface: Typeface): Snacky {
+ this.typeFace = typeFace
+ return this
+ }
+
+ fun onTop(): Snacky {
+ this.layoutGravity = Gravity.TOP
+ return this
+ }
+
+ fun show() {
+ val decorView = activity.window.decorView as ViewGroup
+ val content = decorView.findById(android.R.id.content)
+ if (this.parent == null) {
+ val container = if (this.layoutGravity == Gravity.BOTTOM)
+ content
+ else
+ decorView
+
+ container.forEach {
+ if (it is Snacky) {
+ return
+ }
+ }
+ setGlobals()
+ constructView()
+ container.addView(this)
+ }
+ }
+
+ private fun constructView() {
+ if (title.isNullOrBlank().not()) {
+ with(titleView) {
+ show()
+ text = title
+ setTypeface(typeFace, Typeface.BOLD)
+ setTextColor(titleColor!!)
+ }
+ }
+
+ if (message.isNullOrBlank().not()) {
+ with(messageView) {
+ show()
+ text = message
+ typeface = typeFace
+ setTextColor(messageColor!!)
+ }
+ }
+
+ if (action.isNullOrBlank().not()) {
+ with(actionView) {
+ show()
+ text = action
+ typeface = typeFace
+ setTextColor(actionColor!!)
+ }
+ }
+
+ if (icon != null) {
+ with(iconView) {
+ setImageResource(icon!!)
+ }
+ }
+ with(snackyView) {
+ setBackgroundColor(this@Snacky.background!!)
+ if (layoutGravity == Gravity.TOP) {
+ val params = layoutParams as LayoutParams
+ params.gravity = Gravity.TOP
+ layoutParams = params
+ } else {
+ setPadding(16.dpToPx())
+ }
+ }
+ setAnimations()
+ }
+
+ private var slideOutAnimation: Animation? = null
+
+ private var slideOutAnimationDuration: Long? = null
+
+ private fun setAnimations() {
+ val slideInAnimation = AnimationUtils.loadAnimation(context,
+ if (layoutGravity == Gravity.BOTTOM) R.anim.slide_in_from_bottom else R.anim.slide_in_from_top)
+ slideInAnimation.setAnimationListener(object : Animation.AnimationListener {
+ override fun onAnimationStart(animation: Animation) {
+
+ }
+
+ override fun onAnimationEnd(animation: Animation) {
+ postDelayed({ dismiss() }, 2000)
+ }
+
+ override fun onAnimationRepeat(animation: Animation) {
+
+ }
+ })
+ animation = slideInAnimation
+
+ slideOutAnimation = AnimationUtils.loadAnimation(context,
+ if (layoutGravity == Gravity.BOTTOM) R.anim.slide_out_to_bottom else R.anim.slide_out_to_top)
+ slideOutAnimationDuration = slideOutAnimation!!.duration
+ }
+
+ private fun dismiss() {
+ slideOutAnimation!!.setAnimationListener(object : Animation.AnimationListener {
+ override fun onAnimationStart(animation: Animation) {}
+
+ override fun onAnimationEnd(animation: Animation) {
+ removeFromParent()
+ }
+
+ override fun onAnimationRepeat(animation: Animation) {}
+ })
+ startAnimation(slideOutAnimation)
+ }
+
+ private fun removeFromParent() {
+ postDelayed({
+ val parent = parent
+ if (parent != null) {
+ this.clearAnimation()
+ (parent as ViewGroup).removeView(this)
+ }
+ }, 200)
+ }
+
+ private fun setGlobals() {
+ background = background ?: Contexter.resolveColor(R.attr.snacky_bg, Color.DKGRAY)
+ val fallbackTextColor: Int = Contexter.resolveColor(R.attr.snacky_text_color, Color.WHITE)
+ titleColor = titleColor ?: Contexter.resolveColor(R.attr.snacky_title_text_color, fallbackTextColor)
+ messageColor = messageColor ?: Contexter.resolveColor(R.attr.snacky_message_text_color, fallbackTextColor)
+ actionColor = actionColor ?: Contexter.resolveColor(R.attr.snacky_action_text_color, fallbackTextColor)
+ typeFace = typeFace ?: FontCache.getFont(Contexter.resolveString(R.attr.toasty_font))
+ }
+
+ override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
+ if (this.layoutGravity == Gravity.TOP) {
+ super.onLayout(changed, l, 0, r, measuredHeight)
+ } else {
+ super.onLayout(changed, l, t, r, b)
+ }
+ }
+}
\ No newline at end of file
diff --git a/lilytoast/src/main/java/me/tuple/lily/toast/Toasty.kt b/lilytoast/src/main/java/me/tuple/lily/toast/Toasty.kt
new file mode 100644
index 0000000..af573bf
--- /dev/null
+++ b/lilytoast/src/main/java/me/tuple/lily/toast/Toasty.kt
@@ -0,0 +1,195 @@
+package me.tuple.lily.toast
+
+import android.content.Context
+import android.graphics.Color
+import android.graphics.Typeface
+import androidx.annotation.*
+import android.util.TypedValue
+import android.view.Gravity
+import android.widget.ImageView
+import android.widget.TextView
+import android.widget.Toast
+import androidx.cardview.widget.CardView
+import me.tuple.lily.R
+import me.tuple.lily.core.*
+import me.tuple.lily.utils.FontCache
+
+/**
+ * Created by LazyLoop.
+ * */
+
+@Suppress("Unused")
+class Toasty(private val context: Context) {
+
+ private lateinit var message: String
+
+ private var undoMessage: String? = null
+
+ @ColorInt
+ private var background: Int? = null
+
+ private var duration: Int = Toast.LENGTH_SHORT
+
+ private var icon: Int? = null
+
+ private var typeFace: Typeface? = null
+
+ private var fontSize: Int? = null
+
+ private var undoCallback: ((Boolean) -> Unit)? = null
+
+ private var fontColor: Int? = null
+
+
+ fun message(@StringRes message: Int): Toasty {
+ message(context.getString(message))
+ return this
+ }
+
+ fun message(message: String): Toasty {
+ this.message = message
+ return this
+ }
+
+ fun duration(duration: Int): Toasty {
+ this.duration = duration
+ return this
+ }
+
+ fun backgroundRes(@ColorRes bg: Int): Toasty {
+ this.background = Contexter.getColor(bg)
+ return this
+ }
+
+ fun background(@ColorInt bg: Int): Toasty {
+ this.background = bg
+ return this
+ }
+
+ fun icon(@DrawableRes icon: Int): Toasty {
+ this.icon = icon
+ return this
+ }
+
+ fun fontSizeRes(@DimenRes fontSize: Int): Toasty {
+ this.fontSize = Contexter.getDimensionPixelSize(fontSize)
+ return this
+ }
+
+ fun fontSizeDp(fontSize: Int): Toasty {
+ this.fontSize = fontSize.dpToPx()
+ return this
+ }
+
+ fun font(fontName: String): Toasty {
+ this.typeFace = FontCache.getFont(fontName)
+ return this
+ }
+
+ fun font(typeface: Typeface): Toasty {
+ this.typeFace = typeface
+ return this
+ }
+
+ fun fontColorRes(@ColorRes color: Int): Toasty {
+ this.fontColor = Contexter.getColor(color)
+ return this
+ }
+
+ fun fontColor(@ColorInt fontColor: Int): Toasty {
+ this.fontColor = fontColor
+ return this
+ }
+
+ fun undo(message: String, undoCallback: (Boolean) -> Unit): Toasty {
+ this.undoMessage = message
+ this.undoCallback = undoCallback
+ return this
+ }
+
+ fun show() {
+ setGlobals()
+ val toast = constructToasty()
+ toast.show()
+ }
+
+ private fun constructToasty(): Toast {
+ val toast = Toast(context)
+ toast.duration = duration
+ val inflater = context.layoutInflater
+ val view = inflater.inflate(R.layout.toasty_layout, null)
+ toast.view = view
+ toast.setGravity(Gravity.BOTTOM or Gravity.FILL_HORIZONTAL, 16.dpToPx(), 16.dpToPx())
+ with(view) {
+ findById(R.id.toast_bg).apply {
+ setCardBackgroundColor(this@Toasty.background!!)
+ }
+
+ if (icon != null) {
+ findById(R.id.toasty_icon).apply {
+ show()
+ setImageResource(this@Toasty.icon!!)
+ }
+ }
+
+ findById(R.id.toasty_message).apply {
+ text = message
+ typeface = typeFace
+ setTextColor(fontColor!!)
+ setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize!!.toFloat())
+ }
+ }
+ return toast
+ }
+
+ private fun setGlobals() {
+ background = background ?: Contexter.resolveColor(R.attr.toasty_bg, Color.DKGRAY)
+ typeFace = typeFace ?: FontCache.getFont(Contexter.resolveString(R.attr.toasty_font))
+ fontSize = fontSize ?: Contexter.resolveDimension(R.attr.toasty_font_size, 16.dpToPx())
+ fontColor = fontColor ?: Contexter.resolveColor(R.attr.toasty_font_color, Color.WHITE)
+ }
+}
+
+fun toasty(message: Int) {
+ Toasty(Contexter.context).apply {
+ message(message)
+ }.show()
+}
+
+fun toasty(message: String) {
+ Toasty(Contexter.context).apply {
+ message(message)
+ }.show()
+}
+
+fun toastyError(message: Int, custom: ((Toasty) -> Unit)? = null) {
+ Toasty(Contexter.context).apply {
+ icon(R.drawable.ic_alert_circle)
+ message(message)
+ custom?.invoke(this)
+ }.show()
+}
+
+fun toastyError(message: String, custom: ((Toasty) -> Unit)? = null) {
+ Toasty(Contexter.context).apply {
+ message(message)
+ icon(R.drawable.ic_alert_circle)
+ custom?.invoke(this)
+ }.show()
+}
+
+fun toastySuccess(message: String, custom: ((Toasty) -> Unit)? = null) {
+ Toasty(Contexter.context).apply {
+ message(message)
+ icon(R.drawable.ic_check_circle)
+ custom?.invoke(this)
+ }.show()
+}
+
+fun toastySuccess(message: Int, custom: ((Toasty) -> Unit)? = null) {
+ Toasty(Contexter.context).apply {
+ message(message)
+ icon(R.drawable.ic_check_circle)
+ custom?.invoke(this)
+ }.show()
+}
\ No newline at end of file
diff --git a/lilytoast/src/main/res/anim/slide_in_from_bottom.xml b/lilytoast/src/main/res/anim/slide_in_from_bottom.xml
new file mode 100644
index 0000000..b25a451
--- /dev/null
+++ b/lilytoast/src/main/res/anim/slide_in_from_bottom.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/anim/slide_in_from_top.xml b/lilytoast/src/main/res/anim/slide_in_from_top.xml
new file mode 100644
index 0000000..1fa4521
--- /dev/null
+++ b/lilytoast/src/main/res/anim/slide_in_from_top.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/anim/slide_out_to_bottom.xml b/lilytoast/src/main/res/anim/slide_out_to_bottom.xml
new file mode 100644
index 0000000..3ceb44d
--- /dev/null
+++ b/lilytoast/src/main/res/anim/slide_out_to_bottom.xml
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/anim/slide_out_to_top.xml b/lilytoast/src/main/res/anim/slide_out_to_top.xml
new file mode 100644
index 0000000..bb0c715
--- /dev/null
+++ b/lilytoast/src/main/res/anim/slide_out_to_top.xml
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/drawable/ic_alert_circle.png b/lilytoast/src/main/res/drawable/ic_alert_circle.png
new file mode 100644
index 0000000..058c3f7
Binary files /dev/null and b/lilytoast/src/main/res/drawable/ic_alert_circle.png differ
diff --git a/lilytoast/src/main/res/drawable/ic_check_circle.png b/lilytoast/src/main/res/drawable/ic_check_circle.png
new file mode 100644
index 0000000..aed7b6f
Binary files /dev/null and b/lilytoast/src/main/res/drawable/ic_check_circle.png differ
diff --git a/lilytoast/src/main/res/layout/snacky_layout.xml b/lilytoast/src/main/res/layout/snacky_layout.xml
new file mode 100644
index 0000000..9a7c831
--- /dev/null
+++ b/lilytoast/src/main/res/layout/snacky_layout.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/layout/toasty_layout.xml b/lilytoast/src/main/res/layout/toasty_layout.xml
new file mode 100644
index 0000000..9409fb8
--- /dev/null
+++ b/lilytoast/src/main/res/layout/toasty_layout.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/values/attrs.xml b/lilytoast/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..bf33492
--- /dev/null
+++ b/lilytoast/src/main/res/values/attrs.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lilytoast/src/main/res/values/dimens.xml b/lilytoast/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..3c0b40b
--- /dev/null
+++ b/lilytoast/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 10dp
+ 16dp
+
\ No newline at end of file
diff --git a/lilytoast/src/main/res/values/strings.xml b/lilytoast/src/main/res/values/strings.xml
new file mode 100644
index 0000000..57c3679
--- /dev/null
+++ b/lilytoast/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+ lilytoast
+ Undo
+
diff --git a/lilytoast/src/test/java/me/tuple/lily/ExampleUnitTest.java b/lilytoast/src/test/java/me/tuple/lily/ExampleUnitTest.java
new file mode 100644
index 0000000..3b49356
--- /dev/null
+++ b/lilytoast/src/test/java/me/tuple/lily/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package me.tuple.lily;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/local.properties b/local.properties
index d21075b..43e1f0b 100644
--- a/local.properties
+++ b/local.properties
@@ -4,6 +4,6 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-#Fri Oct 11 07:41:06 EEST 2019
+#Sat Oct 19 13:30:06 EEST 2019
ndk.dir=/home/pawlo/Android/Sdk/ndk-bundle
sdk.dir=/home/pawlo/Android/Sdk
diff --git a/remote/build.gradle b/remote/build.gradle
deleted file mode 100644
index 22baeed..0000000
--- a/remote/build.gradle
+++ /dev/null
@@ -1,75 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'kotlin-kapt'
-apply plugin: 'com.github.dcendents.android-maven'
-group = 'com.github.VRGsoftUA'
-
-android {
- compileSdkVersion sdk_compile_version
-
- defaultConfig {
- minSdkVersion sdk_min_version
- targetSdkVersion sdk_compile_version
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
-
- compileOptions {
- sourceCompatibility 1.8
- targetCompatibility 1.8
- }
-
- kotlinOptions {
- jvmTarget = "1.8"
- }
-
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- androidTest.java.srcDirs += 'src/androidTest/kotlin'
- androidTest.resources.srcDirs += 'src/androidTest/res'
- }
-
-}
-
-dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- rootProject.coreRemote.each {
- add(it.configuration, it.dependency, it.options)
- }
-}
-
-task sourcesJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.java.sourceFiles
-}
-
-task javadoc(type: Javadoc) {
- source = android.sourceSets.main.java.sourceFiles
- classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
-}
-
-task classesJar(type: Jar) {
- from "$buildDir/intermediates/classes/release"
-}
-
-artifacts {
- archives classesJar
- archives javadocJar
- archives sourcesJar
-}
diff --git a/remote/remote.iml b/remote/remote.iml
deleted file mode 100644
index 40c62cb..0000000
--- a/remote/remote.iml
+++ /dev/null
@@ -1,226 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/remote/retrofit.iml b/remote/retrofit.iml
deleted file mode 100644
index 67823cd..0000000
--- a/remote/retrofit.iml
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/remote/src/main/AndroidManifest.xml b/remote/src/main/AndroidManifest.xml
deleted file mode 100644
index 0abfce0..0000000
--- a/remote/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/remote/src/main/java/com/vrgsoft/remote/BaseRepository.kt b/remote/src/main/java/com/vrgsoft/remote/BaseRepository.kt
deleted file mode 100644
index 10cc84d..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/BaseRepository.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.vrgsoft.remote
-
-import androidx.annotation.VisibleForTesting
-import com.vrgsoft.remote.error.ConnectionError
-import com.vrgsoft.remote.error.NetworkError
-import com.vrgsoft.remote.result.BaseResult
-import com.vrgsoft.remote.result.ErrorResult
-import com.vrgsoft.remote.result.SuccessResult
-import kotlinx.coroutines.Deferred
-import retrofit2.Response
-
-abstract class BaseRepository {
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
- suspend fun execute(call: (() -> Deferred>)): BaseResult {
- try {
- val result = call.invoke().await()
-
- return if (result.isSuccessful) {
- SuccessResult(result.body()!!)
- } else {
- ErrorResult(
- NetworkError(
- result.code(),
- result.message()
- )
- )
- }
- } catch (e: Exception) {
- return ErrorResult(ConnectionError())
- }
- }
-
- @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
- fun SuccessResult.transform(mapper: ((item: T) -> M)): SuccessResult {
- return SuccessResult(
- mapper.invoke(this.data)
- )
- }
-
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
- fun BaseResult.transformIsSuccess(mapper: ((item: T) -> M)): BaseResult {
- return if (this is SuccessResult<*>) {
- (this as SuccessResult).transform(mapper)
- } else {
- ErrorResult(
- (this as ErrorResult).error
- )
- }
- }
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/Extentions.kt b/remote/src/main/java/com/vrgsoft/remote/Extentions.kt
deleted file mode 100644
index c187e7f..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/Extentions.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.vrgsoft.remote
-
-import com.vrgsoft.remote.result.BaseResult
-import com.vrgsoft.remote.result.SuccessResult
-
-fun BaseResult.mapDataIfSuccess(mapper: ((item: T) -> M)): M? {
- if (this !is SuccessResult) {
- return null
- }
-
- return mapper.invoke(this.data)
-}
-
-fun BaseResult.getDataIfSuccess(): T? {
- if (this !is SuccessResult) {
- return null
- }
-
- return this.data
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/error/BaseError.kt b/remote/src/main/java/com/vrgsoft/remote/error/BaseError.kt
deleted file mode 100644
index 8c4e111..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/error/BaseError.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.vrgsoft.remote.error
-
-abstract class BaseError
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/error/ConnectionError.kt b/remote/src/main/java/com/vrgsoft/remote/error/ConnectionError.kt
deleted file mode 100644
index 4c7d820..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/error/ConnectionError.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.vrgsoft.remote.error
-
-class ConnectionError : BaseError()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/error/NetworkError.kt b/remote/src/main/java/com/vrgsoft/remote/error/NetworkError.kt
deleted file mode 100644
index bf487b6..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/error/NetworkError.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.vrgsoft.remote.error
-
-class NetworkError(
- val code: Int,
- val message: String
-) : BaseError()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/result/BaseResult.kt b/remote/src/main/java/com/vrgsoft/remote/result/BaseResult.kt
deleted file mode 100644
index 03b2d52..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/result/BaseResult.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.vrgsoft.remote.result
-
-abstract class BaseResult
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/result/ErrorResult.kt b/remote/src/main/java/com/vrgsoft/remote/result/ErrorResult.kt
deleted file mode 100644
index 44099be..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/result/ErrorResult.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.vrgsoft.remote.result
-
-import com.vrgsoft.remote.error.BaseError
-
-class ErrorResult(
- val error: BaseError
-) : BaseResult()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/result/SuccessResult.kt b/remote/src/main/java/com/vrgsoft/remote/result/SuccessResult.kt
deleted file mode 100644
index b09bd4f..0000000
--- a/remote/src/main/java/com/vrgsoft/remote/result/SuccessResult.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.vrgsoft.remote.result
-
-class SuccessResult(
- val data: T
-) : BaseResult()
\ No newline at end of file
diff --git a/remote/src/main/res/values/strings.xml b/remote/src/main/res/values/strings.xml
deleted file mode 100644
index 36875bf..0000000
--- a/remote/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Core Remote
-
diff --git a/remote/src/test/java/com/vrgsoft/remote/BaseRepositoryTest.kt b/remote/src/test/java/com/vrgsoft/remote/BaseRepositoryTest.kt
deleted file mode 100644
index 3bf81f6..0000000
--- a/remote/src/test/java/com/vrgsoft/remote/BaseRepositoryTest.kt
+++ /dev/null
@@ -1,154 +0,0 @@
-package com.vrgsoft.remote
-
-import com.nhaarman.mockitokotlin2.doReturn
-import com.nhaarman.mockitokotlin2.mock
-import com.vrgsoft.remote.error.ConnectionError
-import com.vrgsoft.remote.error.NetworkError
-import com.vrgsoft.remote.result.ErrorResult
-import com.vrgsoft.remote.result.SuccessResult
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.async
-import kotlinx.coroutines.test.runBlockingTest
-import org.junit.Assert.assertEquals
-import org.junit.Test
-import retrofit2.Response
-
-@ExperimentalCoroutinesApi
-internal class BaseRepositoryTest {
- lateinit var repository: BaseRepository
- lateinit var api: TestApi
-
- private var isSuccess = true
-
- fun setUp() {
- repository = TestRepository()
-
- val response = mock> {
- on { isSuccessful } doReturn isSuccess
- on { body() } doReturn "1"
- on { code() } doReturn 401
- on { message() } doReturn "Unauthorized"
- }
-
- api = mock {
- on { call() } doReturn response.toDeferred()
- }
- }
-
- @Test
- fun transform() {
- setUp()
- val result = SuccessResult("1")
-
- val transformed = with(repository) {
- result.transform { it.toInt() }
- }
-
- assertEquals(1, transformed.data)
- }
-
- @Test
- fun transformIsSuccess() {
- setUp()
- val result = SuccessResult("1")
-
- val transformed = with(repository) {
- result.transformIsSuccess { it.toInt() }
- }
-
- require(transformed is SuccessResult)
- assertEquals(1, transformed.data)
- }
-
- @Test
- fun transformIsConnectionError() {
- setUp()
- val result = ErrorResult(ConnectionError())
-
- val transformed = with(repository) {
- result.transformIsSuccess { it.toInt() }
- }
-
- require(transformed is ErrorResult)
- require(transformed.error is ConnectionError)
- }
-
- @Test
- fun transformIsNetworkError() {
- setUp()
- val code = 401
- val message = "Unauthorized"
- val result = ErrorResult(NetworkError(code, message))
-
- val transformed = with(repository) {
- result.transformIsSuccess { it.toInt() }
- }
-
- require(transformed is ErrorResult)
-
- with(transformed) {
- require(error is NetworkError)
- assertEquals(code, (error as NetworkError).code)
- assertEquals(message, (error as NetworkError).message)
- }
- }
-
- @Test
- fun executeSuccess() {
- isSuccess = true
- setUp()
- val data = "1"
-
- runBlockingTest {
- val transformed = with(repository) {
- execute { api.call() }
- }
-
- require(transformed is SuccessResult)
- assertEquals(data, transformed.data)
- }
- }
-
- @Test
- fun executeError() {
- isSuccess = false
- setUp()
- val code = 401
- val message = "Unauthorized"
-
- runBlockingTest {
- val transformed = with(repository) {
- execute { api.call() }
- }
-
- require(transformed is ErrorResult)
- require(transformed.error is NetworkError)
-
- with(transformed.error as NetworkError) {
- assertEquals(code, this.code)
- assertEquals(message, this.message)
- }
- }
- }
-
- @Test
- fun executeThrow() {
- isSuccess = true
- setUp()
-
- runBlockingTest {
- val transformed = with(repository) {
- execute {
- throw IllegalArgumentException()
- api.call()
- }
- }
-
- require(transformed is ErrorResult)
- require(transformed.error is ConnectionError)
- }
- }
-
- fun T.toDeferred() = GlobalScope.async { this@toDeferred }
-}
\ No newline at end of file
diff --git a/remote/src/test/java/com/vrgsoft/remote/TestApi.kt b/remote/src/test/java/com/vrgsoft/remote/TestApi.kt
deleted file mode 100644
index ce951ad..0000000
--- a/remote/src/test/java/com/vrgsoft/remote/TestApi.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.vrgsoft.remote
-
-import kotlinx.coroutines.Deferred
-import retrofit2.Response
-
-interface TestApi {
- fun call(): Deferred>
-}
\ No newline at end of file
diff --git a/remote/src/test/java/com/vrgsoft/remote/TestRepository.kt b/remote/src/test/java/com/vrgsoft/remote/TestRepository.kt
deleted file mode 100644
index ecdfd8f..0000000
--- a/remote/src/test/java/com/vrgsoft/remote/TestRepository.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.vrgsoft.remote
-
-class TestRepository : BaseRepository()
\ No newline at end of file
diff --git a/remote/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/remote/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
deleted file mode 100644
index 1f0955d..0000000
--- a/remote/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
+++ /dev/null
@@ -1 +0,0 @@
-mock-maker-inline
diff --git a/retrofit/build.gradle b/retrofit/build.gradle
deleted file mode 100644
index 11ab012..0000000
--- a/retrofit/build.gradle
+++ /dev/null
@@ -1,75 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'kotlin-kapt'
-apply plugin: 'com.github.dcendents.android-maven'
-group = 'com.github.VRGsoftUA'
-
-android {
- compileSdkVersion sdk_compile_version
-
- defaultConfig {
- minSdkVersion sdk_min_version
- targetSdkVersion sdk_compile_version
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
-
- compileOptions {
- sourceCompatibility 1.8
- targetCompatibility 1.8
- }
-
- kotlinOptions {
- jvmTarget = "1.8"
- }
-
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- androidTest.java.srcDirs += 'src/androidTest/kotlin'
- androidTest.resources.srcDirs += 'src/androidTest/res'
- }
-
-}
-
-dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- rootProject.retrofitModule.each {
- add(it.configuration, it.dependency, it.options)
- }
-}
-
-task sourcesJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.java.sourceFiles
-}
-
-task javadoc(type: Javadoc) {
- source = android.sourceSets.main.java.sourceFiles
- classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
-}
-
-task classesJar(type: Jar) {
- from "$buildDir/intermediates/classes/release"
-}
-
-artifacts {
- archives classesJar
- archives javadocJar
- archives sourcesJar
-}
\ No newline at end of file
diff --git a/retrofit/retrofit.iml b/retrofit/retrofit.iml
deleted file mode 100644
index 6d36494..0000000
--- a/retrofit/retrofit.iml
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/retrofit/src/main/AndroidManifest.xml b/retrofit/src/main/AndroidManifest.xml
deleted file mode 100644
index bf1669d..0000000
--- a/retrofit/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/retrofit/src/main/java/com/vrgsoft/retrofit/RetrofitModule.kt b/retrofit/src/main/java/com/vrgsoft/retrofit/RetrofitModule.kt
deleted file mode 100644
index 6f64d45..0000000
--- a/retrofit/src/main/java/com/vrgsoft/retrofit/RetrofitModule.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.vrgsoft.retrofit
-
-import android.content.Context
-import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
-import com.vrgsoft.retrofit.common.AuthInterceptor
-import com.vrgsoft.retrofit.common.HeaderInterceptor
-import com.vrgsoft.retrofit.common.RetrofitConfig
-import okhttp3.Cache
-import okhttp3.OkHttpClient
-import okhttp3.logging.HttpLoggingInterceptor
-import org.kodein.di.Kodein
-import org.kodein.di.generic.bind
-import org.kodein.di.generic.instance
-import org.kodein.di.generic.provider
-import org.kodein.di.generic.singleton
-import retrofit2.Retrofit
-import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
-import retrofit2.converter.gson.GsonConverterFactory
-import retrofit2.converter.scalars.ScalarsConverterFactory
-import java.util.concurrent.TimeUnit
-
-object RetrofitModule {
- fun get() = Kodein.Module("RetrofitModule") {
- bind() with singleton {
- Retrofit.Builder()
- .baseUrl(RetrofitConfig.baseUrl)
- .addConverterFactory(ScalarsConverterFactory.create())
- .addConverterFactory(GsonConverterFactory.create())
- .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
- .addCallAdapterFactory(CoroutineCallAdapterFactory())
- .client(instance())
- .build()
- }
-
- bind() with singleton {
- val builder = OkHttpClient.Builder()
-
- builder.cache(instance())
-
- if (BuildConfig.DEBUG) {
- val loggingInterceptor = HttpLoggingInterceptor()
- loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
- builder.addInterceptor(loggingInterceptor)
- }
-
- builder.connectTimeout(100, TimeUnit.SECONDS)
- builder.retryOnConnectionFailure(true)
- builder.addInterceptor(instance())
- builder.addInterceptor(HeaderInterceptor())
- builder.build()
- }
-
- bind() from provider {
- val cacheSize = 10 * 1024 * 1024 // 10 MB
- Cache(instance().cacheDir, cacheSize.toLong())
- }
-
- bind() with singleton { AuthInterceptor(RetrofitConfig.auth) }
- }
-}
\ No newline at end of file
diff --git a/retrofit/src/main/java/com/vrgsoft/retrofit/common/Auth.kt b/retrofit/src/main/java/com/vrgsoft/retrofit/common/Auth.kt
deleted file mode 100644
index 2f93d82..0000000
--- a/retrofit/src/main/java/com/vrgsoft/retrofit/common/Auth.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import okhttp3.Interceptor
-import okhttp3.Response
-
-interface Auth {
- fun process(chain: Interceptor.Chain?): Response
-}
\ No newline at end of file
diff --git a/retrofit/src/main/java/com/vrgsoft/retrofit/common/AuthInterceptor.kt b/retrofit/src/main/java/com/vrgsoft/retrofit/common/AuthInterceptor.kt
deleted file mode 100644
index 23a40a0..0000000
--- a/retrofit/src/main/java/com/vrgsoft/retrofit/common/AuthInterceptor.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import okhttp3.Interceptor
-import okhttp3.Response
-
-class AuthInterceptor(
- private val auth: Auth? = null
-) : Interceptor {
- override fun intercept(chain: Interceptor.Chain?): Response {
- return auth?.process(chain) ?: chain!!.request()!!.newBuilder()?.let {
- chain.proceed(it.build())
- }!!
- }
-}
\ No newline at end of file
diff --git a/retrofit/src/main/java/com/vrgsoft/retrofit/common/HeaderInterceptor.kt b/retrofit/src/main/java/com/vrgsoft/retrofit/common/HeaderInterceptor.kt
deleted file mode 100644
index ebd0f6f..0000000
--- a/retrofit/src/main/java/com/vrgsoft/retrofit/common/HeaderInterceptor.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import okhttp3.Interceptor
-import okhttp3.Response
-
-class HeaderInterceptor : Interceptor {
- override fun intercept(chain: Interceptor.Chain?): Response {
- val builder = chain!!.request()!!.newBuilder()
-
- return chain.proceed(builder.build())
- }
-}
\ No newline at end of file
diff --git a/retrofit/src/main/java/com/vrgsoft/retrofit/common/RetrofitConfig.kt b/retrofit/src/main/java/com/vrgsoft/retrofit/common/RetrofitConfig.kt
deleted file mode 100644
index 5e71034..0000000
--- a/retrofit/src/main/java/com/vrgsoft/retrofit/common/RetrofitConfig.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-object RetrofitConfig {
- lateinit var baseUrl: String
- lateinit var auth: Auth
-}
\ No newline at end of file
diff --git a/retrofit/src/main/res/values/strings.xml b/retrofit/src/main/res/values/strings.xml
deleted file mode 100644
index 183cc99..0000000
--- a/retrofit/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Retrofit
-
diff --git a/settings.gradle b/settings.gradle
index ad9677d..01e5a7f 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1 @@
-include 'app'
-include 'retrofit'
-include 'remote'
\ No newline at end of file
+include ':app', ':lilycore', ':lilypref', ':lilytoast', ':lilyadapter'