diff options
author | Allan Wang <me@allanwang.ca> | 2017-08-21 14:39:00 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-08-30 12:24:19 -0400 |
commit | bf136d76b81835a44a0d9038b2a87806247296e8 (patch) | |
tree | 77e52c71086411aa3fc653dbda6672a186ed5aec /core | |
parent | 17d18daaf591b4ab27e0a7df0bb1c3126e6488be (diff) | |
download | kau-bf136d76b81835a44a0d9038b2a87806247296e8.tar.gz kau-bf136d76b81835a44a0d9038b2a87806247296e8.tar.bz2 kau-bf136d76b81835a44a0d9038b2a87806247296e8.zip |
Fix/kpref-inner-frame-size (#42)
* Fix kpref item barriers
* Revert and add text constraint
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt index 889f347..1eeac1a 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt @@ -18,4 +18,6 @@ const val KAU_ALL = KAU_HORIZONTAL or KAU_VERTICAL const val KAU_COLLAPSED = 0 const val KAU_COLLAPSING = 1 const val KAU_EXPANDING = 2 -const val KAU_EXPANDED = 3
\ No newline at end of file +const val KAU_EXPANDED = 3 + +const val KAU_ELLIPSIS = '\u2026'
\ No newline at end of file diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt index cdb49ea..50a3c29 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt @@ -118,4 +118,8 @@ fun postDelayed(delay: Long, action: () -> Unit) { inline val kauIsMainThread: Boolean get() = Looper.myLooper() == Looper.getMainLooper() -class KauException(message: String) : RuntimeException(message)
\ No newline at end of file +class KauException(message: String) : RuntimeException(message) + +fun String.withMaxLength(n: Int): String = + if (length <= n) this + else substring(0, n-1) + KAU_ELLIPSIS
\ No newline at end of file |