Information Page Improvements (click to search, copy to clipboard, etc) (#1139)

* adds long click to copy details per inorichi/tachiyomi#1127

* Added the latest update date for inorichi/tachiyomi#1098 and possible fix for inorichi/tachiyomi#1141

* cleanup some mistakes I left

* adds modifications to full name display for inorichi/tachiyomi#1141 and click to search on various information pieces for inorichi/tachiyomi#860

* This modifies how the full title shows up in the info pages and also properly ellipsizes the titles in the catalogue/library list views

* Changes full title layout in horizontal mode

* Adds the tags in using AndroidTagGroup library

* reverting the sdk version in the gradle build

* code cleanup

* added back status update
This commit is contained in:
Josh
2018-01-18 12:15:33 -06:00
committed by inorichi
parent fae36aebf4
commit 34d21c1de3
13 changed files with 321 additions and 103 deletions

View File

@@ -1,5 +1,7 @@
package eu.kanade.tachiyomi.util
import java.lang.Math.floor
/**
* Replaces the given string to have at most [count] characters using [replacement] at its end.
* If [replacement] is longer than [count] an exception will be thrown when `length > count`.
@@ -11,3 +13,16 @@ fun String.chop(count: Int, replacement: String = "..."): String {
this
}
/**
* Replaces the given string to have at most [count] characters using [replacement] near the center.
* If [replacement] is longer than [count] an exception will be thrown when `length > count`.
*/
fun String.truncateCenter(count: Int, replacement: String = "..."): String{
if(length <= count)
return this
val pieceLength:Int = floor((count - replacement.length).div(2.0)).toInt()
return "${ take(pieceLength) }$replacement${ takeLast(pieceLength) }"
}