1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-01-26 16:56:28 +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)
?.firstOrNull()
?.let {
addAttachment(
uploadImage(
state.propName,
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
if (uri != null) {
val type = contentResolver.getType(uri)
addAttachment(state.propName, uri, type)
uploadImage(state.propName, uri, type)
}
} else {
// 失敗したら DBからデータを削除
@ -1439,14 +1439,12 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
val bitmap = createResizedBitmap(this, uriArg, resizeTo)
if (bitmap != null) {
try {
val cacheDir = externalCacheDir
val cacheDir = externalCacheDir?.apply{ mkdirs() }
if (cacheDir == null) {
showToast(false, "getExternalCacheDir returns null.")
break
}
cacheDir.mkdir()
val tempFile = File(
cacheDir,
"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) {
showToast(false, "mime type is not provided.")