really fixed #890

This commit is contained in:
Mariotaku Lee 2017-07-16 14:09:23 +08:00
parent 53657c0b51
commit e55a153b5d
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 4 additions and 3 deletions

View File

@ -71,7 +71,7 @@ subprojects {
Kovenant : '3.3.0',
ParcelablePlease : '1.0.2',
Chameleon : '0.9.18',
UniqR : '0.9.3',
UniqR : '0.9.4',
SQLiteQB : '0.9.15',
Glide : '3.7.0',
GlideOkHttp3 : '1.4.0',

View File

@ -94,6 +94,7 @@ class UserQrDialogFragment : BaseDialogFragment() {
val qrCode = QrCode.encodeSegments(segments, QrCode.Ecc.HIGH, 5, 40, -1, true)
val uniqr = UniqR(AndroidPlatform(), background, QrCodeData(qrCode))
uniqr.scale = 3
uniqr.dotSize = 1
uniqr.qrPatternColor = palette.patternColor
val result = uniqr.build().produceResult()
background.recycle()
@ -138,8 +139,8 @@ class UserQrDialogFragment : BaseDialogFragment() {
private fun getOptimalPatternColor(color: Int): Int {
val yiq = IntArray(3)
TwidereColorUtils.colorToYIQ(color, yiq)
if (yiq[0] > 128) {
yiq[0] = 128
if (yiq[0] > 96) {
yiq[0] = 96
return TwidereColorUtils.YIQToColor(Color.alpha(color), yiq)
}
return color