From a2926ff93199a0825095d90f7dc15b1ac683a219 Mon Sep 17 00:00:00 2001
From: kimyujin-com <80165026+kimyujin-com@users.noreply.github.com>
Date: Sun, 18 Feb 2024 18:29:06 +0900
Subject: [PATCH 1/3] =?UTF-8?q?Remove:=20=EC=BB=A4=EB=A6=AC=EC=96=B4=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=98=EA=B8=B0=20=ED=86=A0=EC=8A=A4?=
=?UTF-8?q?=ED=8A=B8=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/mobile/project/ui/career/CareerEditActivityFragment.kt | 2 --
.../mobile/project/ui/career/CareerEditCertificateFragment.kt | 2 --
.../com/mobile/project/ui/career/CareerEditContestFragment.kt | 2 --
.../com/mobile/project/ui/career/CareerEditVolunteerFragment.kt | 2 --
4 files changed, 8 deletions(-)
diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt
index e92bedf..98d4b65 100644
--- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt
+++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt
@@ -75,7 +75,6 @@ class CareerEditActivityFragment : Fragment() {
if (isDeleted) {
//삭제 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_activity_to_fragment_career_activity)
- Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
@@ -85,7 +84,6 @@ class CareerEditActivityFragment : Fragment() {
if (isUpdated) {
//수정 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_activity_to_fragment_career_activity)
- Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt
index 07e06f0..36597ea 100644
--- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt
+++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt
@@ -65,7 +65,6 @@ class CareerEditCertificateFragment : Fragment() {
if (isDeleted) {
//삭제 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_certificate_to_fragment_career_certificate)
- Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
@@ -76,7 +75,6 @@ class CareerEditCertificateFragment : Fragment() {
if (isUpdated) {
//수정 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_certificate_to_fragment_career_certificate)
- Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt
index cd46110..b7e1c33 100644
--- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt
+++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt
@@ -73,7 +73,6 @@ class CareerEditContestFragment : Fragment() {
if (isDeleted) {
//삭제 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_contest_to_fragment_career_contest)
- Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
@@ -83,7 +82,6 @@ class CareerEditContestFragment : Fragment() {
if (isUpdated) {
//수정 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_contest_to_fragment_career_contest)
- Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt
index 0cb729f..979ff6d 100644
--- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt
+++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt
@@ -64,7 +64,6 @@ class CareerEditVolunteerFragment : Fragment() {
if (isDeleted) {
//삭제 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_volunteer_to_fragment_career_volunteer)
- Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
@@ -74,7 +73,6 @@ class CareerEditVolunteerFragment : Fragment() {
if (isUpdated) {
//수정 작업이 완료되면 목록 업데이트
navigate(R.id.action_fragment_edit_volunteer_to_fragment_career_volunteer)
- Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show()
}
})
}
From 2c6152e56b9027f98ee8f8b8e6faf2d34445ef97 Mon Sep 17 00:00:00 2001
From: kimyujin-com <80165026+kimyujin-com@users.noreply.github.com>
Date: Mon, 19 Feb 2024 19:55:24 +0900
Subject: [PATCH 2/3] =?UTF-8?q?Feat:=20=EC=99=B8=EB=B6=80=20=ED=8C=8C?=
=?UTF-8?q?=EC=9D=BC=20=EC=A0=91=EA=B7=BC=20=EA=B6=8C=ED=95=9C=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/AndroidManifest.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2b9f6f5..27daecb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">
+
+
+
Date: Mon, 19 Feb 2024 19:56:27 +0900
Subject: [PATCH 3/3] =?UTF-8?q?Fix:=20=EC=BB=A4=EB=A6=AC=EC=96=B4=20?=
=?UTF-8?q?=EB=8C=80=EC=99=B8=ED=99=9C=EB=8F=99=20=EB=8D=94=ED=95=98?=
=?UTF-8?q?=EA=B8=B0/=EC=88=98=EC=A0=95=ED=95=98=EA=B8=B0=20=EC=B9=B4?=
=?UTF-8?q?=EB=A9=94=EB=9D=BC=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=A0=84?=
=?UTF-8?q?=EC=86=A1=20=EA=B0=80=EB=8A=A5=ED=95=98=EA=B2=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../project/ui/career/UploadBottomFragment.kt | 39 ++++++++++++++++++-
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/UploadBottomFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/UploadBottomFragment.kt
index 1c436a8..008b941 100644
--- a/app/src/main/java/umc/com/mobile/project/ui/career/UploadBottomFragment.kt
+++ b/app/src/main/java/umc/com/mobile/project/ui/career/UploadBottomFragment.kt
@@ -1,8 +1,12 @@
package umc.com.mobile.project.ui.career
+import android.Manifest
import android.app.Activity
import android.content.Context
import android.content.Intent
+import android.content.pm.PackageManager
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
import android.net.Uri
import android.os.Bundle
import android.provider.OpenableColumns
@@ -10,6 +14,8 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
+import androidx.core.content.ContextCompat
import androidx.fragment.app.activityViewModels
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import umc.com.mobile.project.databinding.FragmentUploadBottomBinding
@@ -26,6 +32,9 @@ class UploadBottomFragment(context: Context, private val viewModelType: Int) :
private val editViewModel: CareerEditActivityViewModel by activityViewModels()
private val binding get() = _binding!!
+ private val REQUEST_CODE_PERMISSIONS = 10
+ private val REQUIRED_PERMISSIONS = arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)
+
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -44,9 +53,28 @@ class UploadBottomFragment(context: Context, private val viewModelType: Int) :
_binding!!.ivUploadBottomClose.setOnClickListener {
dialog!!.dismiss()
}
+
+ if (!allPermissionsGranted()) {
+ requestPermissions(REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS)
+ }
return binding.root
}
+ private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
+ ContextCompat.checkSelfPermission(requireContext(), it) == PackageManager.PERMISSION_GRANTED
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
+ if (requestCode == REQUEST_CODE_PERMISSIONS) {
+ if (allPermissionsGranted()) {
+ // 권한이 모두 부여되었을 때 실행할 코드를 여기에 작성합니다.
+ } else {
+ Toast.makeText(requireContext(), "Permissions not granted by the user.", Toast.LENGTH_SHORT).show()
+ activity?.finish()
+ }
+ }
+ }
+
private val PICK_IMAGE_MULTIPLE = 2
private fun openGallery() {
@@ -68,13 +96,20 @@ class UploadBottomFragment(context: Context, private val viewModelType: Int) :
}
private fun createImageFile(uri: Uri): File {
- val fileName = "img_" + System.currentTimeMillis() + ".jpg"
+ val fileName = getFileName(uri)
val directory = requireContext().getExternalFilesDir(null)
val file = File(directory, fileName)
val inputStream = requireContext().contentResolver.openInputStream(uri)
+ val originalBitmap = BitmapFactory.decodeStream(inputStream)
+
+ // 이미지 리사이징
+ val newWidth = originalBitmap.width / 2
+ val newHeight = originalBitmap.height / 2
+ val resizedBitmap = Bitmap.createScaledBitmap(originalBitmap, newWidth, newHeight, true)
+
val outputStream: OutputStream = FileOutputStream(file)
- inputStream?.copyTo(outputStream)
+ resizedBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream)
inputStream?.close()
outputStream.close()