diff --git a/build.gradle b/build.gradle index e0e7aec..328430d 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ allprojects { } ext { - libraryVersion = '0.1.3' + libraryVersion = '0.1.4' } task clean(type: Delete) { diff --git a/mvp/build.gradle b/mvp/build.gradle index 3faf8c8..bc9d0c8 100644 --- a/mvp/build.gradle +++ b/mvp/build.gradle @@ -10,7 +10,7 @@ android { minSdkVersion 16 targetSdkVersion 26 versionCode 1 - versionName "1.0" + versionName "0.1" } buildTypes { release { diff --git a/vitals/src/main/java/com/kotlindroid/vitals/Common.kt b/vitals/src/main/java/com/kotlindroid/vitals/Common.kt index 5a02556..1b5c598 100644 --- a/vitals/src/main/java/com/kotlindroid/vitals/Common.kt +++ b/vitals/src/main/java/com/kotlindroid/vitals/Common.kt @@ -82,13 +82,12 @@ inline fun Any.safeFromException(block: EmptyBlock){ } } -inline fun fromApi(version: Int, block: EmptyBlock) { - if (Build.VERSION.SDK_INT >= version) block() -} -inline fun toApi(version: Int, block: EmptyBlock) { - if (Build.VERSION.SDK_INT <= version) block() -} - +//inline fun fromApi(version: Int, block: EmptyBlock) { +// if (Build.VERSION.SDK_INT >= version) block() +//} +//inline fun toApi(version: Int, block: EmptyBlock) { +// if (Build.VERSION.SDK_INT <= version) block() +//} fun ByteArray.toBitmap() = BitmapFactory.decodeByteArray(this, 0, this.size) diff --git a/vitals/src/main/java/com/kotlindroid/vitals/Conversions.kt b/vitals/src/main/java/com/kotlindroid/vitals/Conversions.kt new file mode 100644 index 0000000..ea8376d --- /dev/null +++ b/vitals/src/main/java/com/kotlindroid/vitals/Conversions.kt @@ -0,0 +1,26 @@ +package com.kotlindroid.vitals + +/** + * Created by arnis on 8/11/2017. + */ + +val Float.d : Double + get() = toDouble() +val Float.s : String + get() = toString() +val Float.i : Int + get() = toInt() + +val Double.f : Float + get() = toFloat() +val Double.s : String + get() = toString() +val Double.i : Int + get() = toInt() + +val String.d : Double + get() = toDouble() +val String.f : Float + get() = toFloat() +val String.i : Int + get() = toInt() \ No newline at end of file diff --git a/vitals/src/main/java/com/kotlindroid/vitals/View.kt b/vitals/src/main/java/com/kotlindroid/vitals/View.kt index 822103c..b17207b 100644 --- a/vitals/src/main/java/com/kotlindroid/vitals/View.kt +++ b/vitals/src/main/java/com/kotlindroid/vitals/View.kt @@ -119,11 +119,13 @@ fun ImageView.getImageByteArray() : ByteArray = (drawable as BitmapDrawable).bit fun AppCompatActivity.bitmapFromRes(resId: Int) = BitmapFactory.decodeResource(resources,resId) -fun Context.dpToPx(value: Int) = resources.displayMetrics.density * value +//fun Context.dpToPx(value: Int) = resources.displayMetrics.density * value val View.screenHeight: Int get() = resources.displayMetrics.heightPixels val View.screenWidth: Int get() = resources.displayMetrics.widthPixels +val View.density: Float + get() = resources.displayMetrics.density fun Activity.getStringRes(resId: Int) = resources.getString(resId) fun Context.getStringRes(resId: Int) = resources.getString(resId)