trying to fix image orientation

This commit is contained in:
Mariotaku Lee 2017-01-08 01:07:12 +08:00
parent d46731db23
commit 9b5d0e7c64
3 changed files with 26 additions and 3 deletions

View File

@ -33,8 +33,8 @@ android {
applicationId "org.mariotaku.twidere" applicationId "org.mariotaku.twidere"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 25 targetSdkVersion 25
versionCode 252 versionCode 253
versionName '3.3.34' versionName '3.3.35'
multiDexEnabled true multiDexEnabled true
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")' buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")'

View File

@ -0,0 +1,18 @@
package org.mariotaku.ktextension
import android.graphics.Color
import org.junit.Assert
import org.junit.Test
/**
* Created by mariotaku on 2017/1/8.
*/
class ColorExtensionsTest {
@Test
fun testToHexColor() {
Assert.assertEquals("#FFFF0000", toHexColor(Color.RED, format = HexColorFormat.ARGB))
Assert.assertEquals("#FF0000", toHexColor(Color.RED, format = HexColorFormat.RGB))
Assert.assertEquals(Color.RED, Color.parseColor(toHexColor(Color.RED)))
}
}

View File

@ -10,6 +10,7 @@ import android.support.annotation.UiThread
import android.support.annotation.WorkerThread import android.support.annotation.WorkerThread
import android.text.TextUtils import android.text.TextUtils
import android.util.Pair import android.util.Pair
import com.nostra13.universalimageloader.core.DisplayImageOptions
import com.nostra13.universalimageloader.core.assist.ImageSize import com.nostra13.universalimageloader.core.assist.ImageSize
import edu.tsinghua.hotmobi.HotMobiLogger import edu.tsinghua.hotmobi.HotMobiLogger
import edu.tsinghua.hotmobi.model.MediaUploadEvent import edu.tsinghua.hotmobi.model.MediaUploadEvent
@ -705,8 +706,12 @@ class UpdateStatusTask(
sizeLimit.x, sizeLimit.y) sizeLimit.x, sizeLimit.y)
o.inJustDecodeBounds = false o.inJustDecodeBounds = false
if (o.outWidth > 0 && o.outHeight > 0 && mediaType != "image/gif") { if (o.outWidth > 0 && o.outHeight > 0 && mediaType != "image/gif") {
val displayOptions = DisplayImageOptions.Builder()
.considerExifParams(true)
.build()
val bitmap = mediaLoader.loadImageSync(mediaUri.toString(), val bitmap = mediaLoader.loadImageSync(mediaUri.toString(),
ImageSize(o.outWidth, o.outHeight).scaleDown(o.inSampleSize)) ImageSize(o.outWidth, o.outHeight).scaleDown(o.inSampleSize),
displayOptions)
if (bitmap != null) { if (bitmap != null) {
size.set(bitmap.width, bitmap.height) size.set(bitmap.width, bitmap.height)