1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-01-27 09:11:23 +01:00

アカウント設定画面の関数名が紛らわしかったのを直す

This commit is contained in:
tateisu 2022-01-05 12:37:40 +09:00
parent dac4ed79c2
commit d18ed22ead

View File

@ -151,7 +151,7 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
?.handleGetContentResult(contentResolver) ?.handleGetContentResult(contentResolver)
?.firstOrNull() ?.firstOrNull()
?.let { ?.let {
addAttachment( uploadImage(
state.propName, state.propName,
it.uri, it.uri,
it.mimeType?.notEmpty() ?: contentResolver.getType(it.uri) it.mimeType?.notEmpty() ?: contentResolver.getType(it.uri)
@ -166,7 +166,7 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
val uri = ar.data?.data ?: state.uriCameraImage val uri = ar.data?.data ?: state.uriCameraImage
if (uri != null) { if (uri != null) {
val type = contentResolver.getType(uri) val type = contentResolver.getType(uri)
addAttachment(state.propName, uri, type) uploadImage(state.propName, uri, type)
} }
} else { } else {
// 失敗したら DBからデータを削除 // 失敗したら DBからデータを削除
@ -1439,14 +1439,12 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
val bitmap = createResizedBitmap(this, uriArg, resizeTo) val bitmap = createResizedBitmap(this, uriArg, resizeTo)
if (bitmap != null) { if (bitmap != null) {
try { try {
val cacheDir = externalCacheDir val cacheDir = externalCacheDir?.apply{ mkdirs() }
if (cacheDir == null) { if (cacheDir == null) {
showToast(false, "getExternalCacheDir returns null.") showToast(false, "getExternalCacheDir returns null.")
break break
} }
cacheDir.mkdir()
val tempFile = File( val tempFile = File(
cacheDir, cacheDir,
"tmp." + System.currentTimeMillis() + "." + Thread.currentThread().id "tmp." + System.currentTimeMillis() + "." + Thread.currentThread().id
@ -1502,7 +1500,7 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
} }
} }
private fun addAttachment(propName: String, uri: Uri, mimeType: String?) { private fun uploadImage(propName: String, uri: Uri, mimeType: String?) {
if (mimeType == null) { if (mimeType == null) {
showToast(false, "mime type is not provided.") showToast(false, "mime type is not provided.")