-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # README.md # build.gradle # gradle.properties # kotlinknifer/build.gradle # kotlinknifer/src/main/java/com/devrapid/kotlinknifer/EditText.kt # kotlinshaver/build.gradle # sample/build.gradle
- Loading branch information
Showing
23 changed files
with
157 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,17 @@ org.gradle.jvmargs=-Xmx1536m | |
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true | ||
android.useAndroidX=true | ||
android.enableJetifier=true | ||
|
||
#### For JCenter #### | ||
## Project information | ||
proj_repo=maven | ||
proj_name=kotlinknifer | ||
proj_libname=KotlinKnifer | ||
proj_group=com.devrapid.jieyi | ||
proj_artifactid=kotlinknifer | ||
proj_version=1.5.9 | ||
proj_version=2.1.0 | ||
proj_description=For developing an Android conveniently and rapidly. | ||
proj_websiteurl=https://github.com/pokk/KotlinKnifer | ||
proj_issuetrackerurl=https://github.com/pokk/KotlinKnifer/issues | ||
|
@@ -36,4 +39,4 @@ [email protected] | |
proj_kotlin_name=kotlinshaver | ||
proj_kotlin_libname=KotlinShaver | ||
proj_kotlin_artifactid=kotlinshaver | ||
proj_kotlin_version=0.2.4 | ||
proj_kotlin_version=1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Jan 24 11:07:46 JST 2018 | ||
#Wed Jul 18 12:01:20 JST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 13 additions & 8 deletions
21
kotlinknifer/src/main/java/com/devrapid/kotlinknifer/Coroutine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
@file:Suppress("NOTHING_TO_INLINE") | ||
|
||
package com.devrapid.kotlinknifer | ||
|
||
import kotlinx.coroutines.experimental.CoroutineScope | ||
import kotlinx.coroutines.experimental.android.UI | ||
import kotlinx.coroutines.experimental.launch | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers.Default | ||
import kotlinx.coroutines.Dispatchers.IO | ||
import kotlinx.coroutines.Dispatchers.Main | ||
import kotlinx.coroutines.GlobalScope | ||
import kotlinx.coroutines.launch | ||
|
||
inline fun ui(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Main, block = block) | ||
|
||
inline fun bkg(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Default, block = block) | ||
|
||
/** | ||
* @author Jieyi Wu | ||
* @since 2018/04/04 | ||
*/ | ||
fun ui(block: suspend CoroutineScope.() -> Unit) = launch(UI, block = block) | ||
inline fun io(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(IO, block = block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
kotlinknifer/src/main/java/com/devrapid/kotlinknifer/EditText.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
kotlinknifer/src/main/java/com/devrapid/kotlinknifer/TextView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.devrapid.kotlinknifer | ||
|
||
import android.widget.TextView | ||
import androidx.annotation.DrawableRes | ||
import androidx.annotation.IntDef | ||
import com.devrapid.kotlinknifer.DrawableDriection.DRAWABLE_DIRECTION_BOTTOM | ||
import com.devrapid.kotlinknifer.DrawableDriection.DRAWABLE_DIRECTION_END | ||
import com.devrapid.kotlinknifer.DrawableDriection.DRAWABLE_DIRECTION_START | ||
import com.devrapid.kotlinknifer.DrawableDriection.DRAWABLE_DIRECTION_TOP | ||
import kotlin.annotation.AnnotationRetention.SOURCE | ||
import kotlin.annotation.AnnotationTarget.FIELD | ||
import kotlin.annotation.AnnotationTarget.TYPE | ||
import kotlin.annotation.AnnotationTarget.VALUE_PARAMETER | ||
|
||
/** | ||
* @author jieyi | ||
* @since 09/11/18 | ||
*/ | ||
object DrawableDriection { | ||
const val DRAWABLE_DIRECTION_START = 0x1 | ||
const val DRAWABLE_DIRECTION_TOP = 0x2 | ||
const val DRAWABLE_DIRECTION_END = 0x4 | ||
const val DRAWABLE_DIRECTION_BOTTOM = 0x8 | ||
} | ||
|
||
@Retention(SOURCE) | ||
@Target(TYPE, FIELD, VALUE_PARAMETER) | ||
@IntDef(DRAWABLE_DIRECTION_START, | ||
DRAWABLE_DIRECTION_TOP, | ||
DRAWABLE_DIRECTION_END, | ||
DRAWABLE_DIRECTION_BOTTOM) | ||
annotation class DrawableDirection | ||
|
||
fun TextView.addDrawable( | ||
@DrawableRes drawableId: Int, | ||
@DrawableDirection direct: Int, | ||
ratioWidth: Float = 1f, | ||
ratioHeight: Float = 1f | ||
) { | ||
// Modify the icon size. | ||
context.scaledDrawable(drawableId, ratioWidth, ratioHeight) | ||
// Modify the icon bound. | ||
.apply { setBounds(0, 0, (minimumWidth * ratioWidth).toInt(), (minimumHeight * ratioHeight).toInt()) } | ||
.let { | ||
when (direct) { | ||
DRAWABLE_DIRECTION_START -> setCompoundDrawables(it, null, null, null) | ||
DRAWABLE_DIRECTION_TOP -> setCompoundDrawables(null, it, null, null) | ||
DRAWABLE_DIRECTION_END -> setCompoundDrawables(null, null, it, null) | ||
DRAWABLE_DIRECTION_BOTTOM -> setCompoundDrawables(null, null, null, it) | ||
} | ||
} | ||
} |
Oops, something went wrong.