Skip to content

Commit

Permalink
Updated dependencies, docs and adapted some methods to meet latest su…
Browse files Browse the repository at this point in the history
…pport library changes
  • Loading branch information
mradzinski committed Feb 10, 2018
1 parent 57e5d1a commit 04f3520
Show file tree
Hide file tree
Showing 70 changed files with 2,088 additions and 194 deletions.
37 changes: 3 additions & 34 deletions bkotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,17 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka-android'

ext {
bintrayRepo = 'bixlabs'
bintrayName = 'BKotlin'

publishedGroupId = 'com.bixlabs.bkotlin'
libraryName = 'BKotlin'
artifact = 'bkotlin'

libraryDescription = 'Bixlabs Kotlin Extensions'

siteUrl = 'https://www.bixlabs.com'
gitUrl = 'https://github.com/bixlabs/bkotlin.git'

libraryVersion = '1.0.0'

developerId = 'mradzinski'
developerName = 'Matias Radzinski'
developerEmail = '[email protected]'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}

//task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
// classifier = 'javadoc'
// from "$buildDir/javadoc"
//}

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"

compileSdkVersion 27

defaultConfig {
minSdkVersion 16
targetSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0.0"

Expand All @@ -64,7 +33,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compileOnly 'com.android.support:appcompat-v7:26.1.0'
compileOnly 'com.android.support:appcompat-v7:27.0.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
Expand Down
2 changes: 1 addition & 1 deletion bkotlin/src/main/java/com/bixlabs/bkotlin/Dimension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fun Activity.getDisplayMetrics(): DisplayMetrics {
*/
fun Fragment.getDisplayMetrics(): DisplayMetrics {
val metrics = DisplayMetrics()
activity.windowManager.defaultDisplay.getMetrics(metrics)
activity?.windowManager?.defaultDisplay?.getMetrics(metrics)

return metrics
}
29 changes: 17 additions & 12 deletions bkotlin/src/main/java/com/bixlabs/bkotlin/Drawable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,25 @@ fun Context.getDrawableCompat(@DrawableRes resId: Int): Drawable? {
* Specifies a tint for drawable as a color state list.
*/
fun Context.getDrawableSelectorCompat(@ColorRes normalColor: Int, @ColorRes pressedColor: Int,
@ColorRes disabledColor: Int, @DrawableRes res: Int): Drawable {
@ColorRes disabledColor: Int, @DrawableRes res: Int): Drawable? {

val drawable = DrawableCompat.wrap(ContextCompat.getDrawable(this, res)).mutate()
val contextCompatDawable = ContextCompat.getDrawable(this, res)
if (contextCompatDawable != null) {
val drawable = DrawableCompat.wrap(contextCompatDawable).mutate()

DrawableCompat.setTintList(drawable,
ColorStateList(
arrayOf(intArrayOf(android.R.attr.state_enabled, -android.R.attr.state_pressed),
intArrayOf(android.R.attr.state_enabled, android.R.attr.state_pressed),
intArrayOf(-android.R.attr.state_enabled)),
DrawableCompat.setTintList(drawable,
ColorStateList(
arrayOf(intArrayOf(android.R.attr.state_enabled, -android.R.attr.state_pressed),
intArrayOf(android.R.attr.state_enabled, android.R.attr.state_pressed),
intArrayOf(-android.R.attr.state_enabled)),

intArrayOf(ContextCompat.getColor(this, normalColor),
ContextCompat.getColor(this, pressedColor),
ContextCompat.getColor(this, disabledColor))
))
intArrayOf(ContextCompat.getColor(this, normalColor),
ContextCompat.getColor(this, pressedColor),
ContextCompat.getColor(this, disabledColor))
))

return drawable
return drawable
} else {
return null
}
}
4 changes: 2 additions & 2 deletions bkotlin/src/main/java/com/bixlabs/bkotlin/Keyboard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ fun Activity.hideKeyboard() {
* Hide the soft keyboard
*/
fun Fragment.hideKeyboard() {
val view = this.activity.currentFocus
val view = this.activity?.currentFocus
if (view != null) {
val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
val imm = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
}
}
Expand Down
4 changes: 2 additions & 2 deletions bkotlin/src/main/java/com/bixlabs/bkotlin/View.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fun Activity.setFocusToView(view: View) {
* Gives focus to the passed view once the view has been completely inflated
*/
fun Fragment.setFocusToView(view: View) {
val handler = Handler(this.activity.mainLooper)
val handler = Handler(this.activity?.mainLooper)
handler.post { view.requestFocus() }
}

Expand All @@ -40,7 +40,7 @@ fun Activity.setTouchFocusToView(view: View) {
* inflated using `view.requestFocusFromTouch`
*/
fun Fragment.setTouchFocusToView(view: View) {
val handler = Handler(this.activity.mainLooper)
val handler = Handler(this.activity?.mainLooper)
handler.post { view.requestFocusFromTouch() }
}

Expand Down
8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.10'
ext.kotlin_version = '1.2.21'
ext.dokka_version = '0.9.15'

repositories {
Expand All @@ -26,8 +26,4 @@ allprojects {
google()
jcenter()
}
}

//subprojects {
// tasks.withType(Javadoc).all { enabled = false }
//}
}
9 changes: 7 additions & 2 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:29 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:59 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand Down Expand Up @@ -36,6 +36,11 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="com/bixlabs/bkotlin/GlobalSharedPreferences.html" title="class in com.bixlabs.bkotlin" target="classFrame">GlobalSharedPreferences</a></li>
<li><a href="com/bixlabs/bkotlin/IntentKt.html" title="class in com.bixlabs.bkotlin" target="classFrame">IntentKt</a></li>
<li><a href="com/bixlabs/bkotlin/KeyboardKt.html" title="class in com.bixlabs.bkotlin" target="classFrame">KeyboardKt</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.html" title="class in com.bixlabs.bkotlin" target="classFrame">KOptional</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.Companion.html" title="class in com.bixlabs.bkotlin" target="classFrame">KOptional.Companion</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.EMPTY.html" title="class in com.bixlabs.bkotlin" target="classFrame">KOptional.EMPTY</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.Some.html" title="class in com.bixlabs.bkotlin" target="classFrame">KOptional.Some</a></li>
<li><a href="com/bixlabs/bkotlin/KOptionalKt.html" title="class in com.bixlabs.bkotlin" target="classFrame">KOptionalKt</a></li>
<li><a href="com/bixlabs/bkotlin/KotlinKt.html" title="class in com.bixlabs.bkotlin" target="classFrame">KotlinKt</a></li>
<li><a href="com/bixlabs/bkotlin/LogKt.html" title="class in com.bixlabs.bkotlin" target="classFrame">LogKt</a></li>
<li><a href="com/bixlabs/bkotlin/NotificationKt.html" title="class in com.bixlabs.bkotlin" target="classFrame">NotificationKt</a></li>
Expand Down
9 changes: 7 additions & 2 deletions docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:29 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:59 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand Down Expand Up @@ -36,6 +36,11 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="com/bixlabs/bkotlin/GlobalSharedPreferences.html" title="class in com.bixlabs.bkotlin">GlobalSharedPreferences</a></li>
<li><a href="com/bixlabs/bkotlin/IntentKt.html" title="class in com.bixlabs.bkotlin">IntentKt</a></li>
<li><a href="com/bixlabs/bkotlin/KeyboardKt.html" title="class in com.bixlabs.bkotlin">KeyboardKt</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.html" title="class in com.bixlabs.bkotlin">KOptional</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.Companion.html" title="class in com.bixlabs.bkotlin">KOptional.Companion</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.EMPTY.html" title="class in com.bixlabs.bkotlin">KOptional.EMPTY</a></li>
<li><a href="com/bixlabs/bkotlin/KOptional.Some.html" title="class in com.bixlabs.bkotlin">KOptional.Some</a></li>
<li><a href="com/bixlabs/bkotlin/KOptionalKt.html" title="class in com.bixlabs.bkotlin">KOptionalKt</a></li>
<li><a href="com/bixlabs/bkotlin/KotlinKt.html" title="class in com.bixlabs.bkotlin">KotlinKt</a></li>
<li><a href="com/bixlabs/bkotlin/LogKt.html" title="class in com.bixlabs.bkotlin">LogKt</a></li>
<li><a href="com/bixlabs/bkotlin/NotificationKt.html" title="class in com.bixlabs.bkotlin">NotificationKt</a></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/AlertKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:22 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:51 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AlertKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.AlertKt class">
<meta name="keywords" content="displayAlertDialog()">
<meta name="keywords" content="displayConfirmDialog()">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/AnyKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:22 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:51 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AnyKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.AnyKt class">
<meta name="keywords" content="getTAG()">
<meta name="keywords" content="isNullThen()">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/ApplicationKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:22 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:51 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ApplicationKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.ApplicationKt class">
<meta name="keywords" content="reboot()">
<meta name="keywords" content="getVersionCode()">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/AttemptKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:22 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:51 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AttemptKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.AttemptKt class">
<meta name="keywords" content="attempt()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/AttemptResult.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:22 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:51 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AttemptResult</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.AttemptResult class">
<meta name="keywords" content="then()">
<meta name="keywords" content="isError()">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/BooleanKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:22 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BooleanKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.BooleanKt class">
<meta name="keywords" content="orFalse()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/BuildConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BuildConfig</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.BuildConfig class">
<meta name="keywords" content="DEBUG">
<meta name="keywords" content="APPLICATION_ID">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/BundleKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BundleKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.BundleKt class">
<meta name="keywords" content="bundle()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/Bundlify.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bundlify</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.Bundlify class">
<meta name="keywords" content="getBundle()">
<meta name="keywords" content="setBundle()">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/ByteArrayExtensionsKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ByteArrayExtensionsKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.ByteArrayExtensionsKt class">
<meta name="keywords" content="toHexString()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/ClosedRangeExtensionsKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ClosedRangeExtensionsKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.ClosedRangeExtensionsKt class">
<meta name="keywords" content="random()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/CollectionKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CollectionKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.CollectionKt class">
<meta name="keywords" content="forEachReversed()">
<meta name="keywords" content="forEachReversedIndexed()">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/bixlabs/bkotlin/ColorKt.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Mon Jan 15 20:06:23 UYT 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Fri Feb 09 23:22:52 UYT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ColorKt</title>
<meta name="date" content="2018-01-15">
<meta name="date" content="2018-02-09">
<meta name="keywords" content="com.bixlabs.bkotlin.ColorKt class">
<meta name="keywords" content="getOpaque()">
<meta name="keywords" content="withAlpha()">
Expand Down
Loading

0 comments on commit 04f3520

Please sign in to comment.