Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ dependencies {

// Coroutine
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
implementation("io.coil-kt:coil:2.0.0-rc03")

// RoomDB
def room_version = '2.5.2'
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".presentation.util.ApplicationClass"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class JobGroupAdapter(
// 이미 선택했던 직군 선택시 버튼 변경
if (selectedjobList.contains(tvBtn.text)) {
setBtn(ivBtn, tvBtn, false)
selectedjobList.remove(mapperToJob(tvBtn.text.toString()))
selectedjobList.remove(tvBtn.text.toString())
Log.d("JobGroupAdapter", "removed ${tvBtn.text} from selectedjobList")
}
// 최대 선택 가능한 직군 개수(=3) 제한
Expand All @@ -60,7 +60,7 @@ class JobGroupAdapter(
// 새롭게 직군 선택시 버튼 변경
else {
setBtn(ivBtn, tvBtn, true)
selectedjobList.add(mapperToJob(tvBtn.text.toString()))
selectedjobList.add(tvBtn.text.toString())
Log.d(TAG, selectedjobList.toString())
}
/* 변경사항 */
Expand All @@ -83,6 +83,7 @@ class JobGroupAdapter(
if(flag){
ivBtn.setBackgroundResource(R.drawable.ic_job_button_clicked)
tvBtn.setTextColor(ContextCompat.getColor(context, R.color.sub_bage))

}else{
ivBtn.setBackgroundResource(R.drawable.ic_job_button)
tvBtn.setTextColor(ContextCompat.getColor(context, R.color.black))
Expand All @@ -95,17 +96,7 @@ class JobGroupAdapter(

}

// 직군을 영문으로 매핑 작업
fun mapperToJob(value: String): String{
return when(value){
"철강" -> "steel" "석유·화학" -> "Petroleum/Chemical" "정유" -> "oilrefining" "2차 전지" -> "secondarybattery"
"반도체" -> "Semiconductor" "디스플레이" -> "Display" "휴대폰" -> "Mobile" "IT" -> "it"
"자동차" -> "car" "조선" -> "Shipbuilding" "해운" -> "Shipping" "F&B" -> "FnB"
"소매유통" -> "RetailDistribution" "건설" -> "Construction" "호텔·여행·항공" -> "HotelTravel" "섬유·의류" -> "FiberClothing"
else -> ""
}

}


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.example.cherry_pick_android.databinding.ActivityJobGroupBinding
import com.example.cherry_pick_android.presentation.adapter.JobGroupAdapter
import com.example.cherry_pick_android.presentation.ui.home.HomeActivity
import com.example.cherry_pick_android.presentation.ui.jobGroup.JobGroups.jobgroups
import com.example.cherry_pick_android.presentation.ui.mypage.ProfileActivity
import com.example.cherry_pick_android.presentation.viewmodel.login.LoginViewModel
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -74,7 +75,6 @@ class JobGroupActivity: AppCompatActivity() {

}

/* 주요 변경 사항 (밑에 2문단 코드) */
private val onCompleteButtonStateChanged: () -> Unit = {
updateCompleteButtonState() // 완료 버튼 상태 갱신
}
Expand All @@ -91,6 +91,17 @@ class JobGroupActivity: AppCompatActivity() {
}
}

// 직군을 영문으로 매핑 작업
fun mapperToJob(value: String): String{
return when(value){
"철강" -> "steel" "석유·화학" -> "Petroleum/Chemical" "정유" -> "oilrefining" "2차 전지" -> "secondarybattery"
"반도체" -> "Semiconductor" "디스플레이" -> "Display" "휴대폰" -> "Mobile" "IT" -> "it"
"자동차" -> "car" "조선" -> "Shipbuilding" "해운" -> "Shipping" "F&B" -> "FnB"
"소매유통" -> "RetailDistribution" "건설" -> "Construction" "호텔·여행·항공" -> "HotelTravel" "섬유·의류" -> "FiberClothing"
else -> ""
}
}

// 최초사용자의 여부에 따라 화면전환
private fun onCompleteBtn(){
binding.btnJobComplete.setOnClickListener {
Expand All @@ -108,9 +119,9 @@ class JobGroupActivity: AppCompatActivity() {
gender = gender,
memberNumber = userId,
name = name,
industryKeyword1 = selecetedJobList.getOrElse(0){ "" },
industryKeyword2 = selecetedJobList.getOrElse(1){ "" },
industryKeyword3 = selecetedJobList.getOrElse(2){" "}
industryKeyword1 = mapperToJob(selecetedJobList.getOrElse(0){ "" }),
industryKeyword2 = mapperToJob(selecetedJobList.getOrElse(1){ "" }),
industryKeyword3 = mapperToJob(selecetedJobList.getOrElse(2){" "})
)
lifecycleScope.launch {
val saveUserResponse = saveUserService.saveUserInform(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class LoginActivity: AppCompatActivity() {
binding.tvExplain.text = textToBold(binding.tvExplain.text.toString(), 7, 17)
binding.tvExplain2.text = textToBold(binding.tvExplain2.text.toString(), 0, 16)

onClickLogin()

//onClickLogin()


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.View
import android.view.ViewGroup
import com.example.cherry_pick_android.R
import com.example.cherry_pick_android.databinding.FragmentMypageBinding
import com.example.cherry_pick_android.presentation.ui.newsSearch.NewsSearchActivity

class MyPageFragment : Fragment() {
private var _binding: FragmentMypageBinding? = null
Expand All @@ -31,11 +32,18 @@ class MyPageFragment : Fragment() {

private fun setButton() {
binding.apply {
// 로그아웃
ibtnMypageLogout.setOnClickListener {

}
// 계정설정 (프로필) 페이지로 이동
ibtnMypageToProfile.setOnClickListener{
val intent = Intent(it.context,ProfileActivity::class.java)
it.context.startActivity(intent)
ibtnMypageSetting.setOnClickListener {
activity?.let {
val intent = Intent(it, ProfileActivity::class.java)
it.startActivity(intent)
}
}

// 스토어 별점 남기기 이동
ibtnMoveToScore.setOnClickListener {
// val intent = Intent(Intent.ACTION_VIEW)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,67 @@
package com.example.cherry_pick_android.presentation.ui.mypage

import android.app.Activity
import android.content.ContentValues
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import android.view.Gravity
import android.view.Window
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil.setContentView
import androidx.core.content.ContextCompat
import coil.load
import com.example.cherry_pick_android.R
import com.example.cherry_pick_android.databinding.ActivityProfileBinding
import com.example.cherry_pick_android.presentation.ui.jobGroup.JobGroupActivity
import com.example.cherry_pick_android.presentation.ui.mypage.dialog.CameraDialog
import com.example.cherry_pick_android.presentation.ui.mypage.dialog.CameraDialogInterface
import java.sql.Date
import java.text.SimpleDateFormat

class ProfileActivity : AppCompatActivity() {

class ProfileActivity : AppCompatActivity(),CameraDialogInterface {
private lateinit var binding: ActivityProfileBinding

companion object {
const val REQUEST_CODE_PERMISSIONS = 1001
const val ALBUM_OK = 2002
const val CAMERA_OK = 2003
const val BASIC_OK = 2004
const val TAG = "ProfileActivity"
}


private fun checkPermission(permissions: Array<String>): Boolean {
return permissions.all {
ContextCompat.checkSelfPermission(this, it) == PackageManager.PERMISSION_GRANTED
}
}

// 이미지 로드
private val readImage = registerForActivityResult(
ActivityResultContracts.GetContent()) {
uri -> binding.ivProfilePic.load(uri)
}

// 카메라를 실행한 후 찍은 사진을 저장
var pictureUri: Uri? = null
private val getTakePicture = registerForActivityResult(ActivityResultContracts.TakePicture()) {
if(it) {
pictureUri.let { binding.ivProfilePic.setImageURI(pictureUri) }
}
}
// 파일 불러오기
private val getContentImage = registerForActivityResult(
ActivityResultContracts.GetContent()) {
uri ->
uri.let { binding.ivProfilePic.setImageURI(uri)
}
}
// 직군선택 결과 받아오기
private val getResultText = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()){
result-> if (result.resultCode == RESULT_OK){
Expand All @@ -30,7 +78,7 @@ class ProfileActivity : AppCompatActivity() {
setContentView(view)

goBack()
ChangeImage()
showCameraDialog()
ChangeName()
ChangeJobInterest()
LeaveAccount()
Expand All @@ -45,21 +93,44 @@ class ProfileActivity : AppCompatActivity() {
}

// 프로필 사진 변경
private fun ChangeImage() {
binding.ivProfilePic.setOnClickListener{

// 앨범에서 사진 선택

// 촬영하기->고유 이름으로 파일 생성->갤러리에 사진추가
//dispatchTakePictureIntent()
//createImageFile()
//galleryAddPic()
// 기본 이미지로 변경

// 취소

fun showCameraDialog() {
binding.ibtnProfileCamera.setOnClickListener{
val dialog = CameraDialog(this)
dialog.show(this.supportFragmentManager, "CameraDialog")
}
}
override fun onCameraClick(cameraMenu: String) {
val camera_menu = cameraMenu

//readImage.launch()
// 권한 확인
//checkPermission.launch(permissionList)
//if (!checkPermission(permissions)) {
// requestPermissions(permissions, REQUEST_CODE_PERMISSIONS)
//}

if (camera_menu=="@string/profile_img_fromAlbum"){
getContentImage.launch("image/*")
}
else if (camera_menu=="@string/profile_img_fromCamera"){
pictureUri = createImageFile()
getTakePicture.launch(pictureUri)
}
else if (camera_menu=="@string/profile_img_basic"){
binding.ivProfilePic.setImageResource(R.drawable.ic_my_page_user)
}
else if (camera_menu=="@string/profile_img_cancel"){
// 변화없음
}
}
private fun createImageFile(): Uri? {
val now = SimpleDateFormat("yyMMdd_HHmmss").format(System.currentTimeMillis())
val content = ContentValues().apply {
put(MediaStore.Images.Media.DISPLAY_NAME, "img_$now.jpg")
put(MediaStore.Images.Media.MIME_TYPE, "image/jpg")
}
return contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, content)
}

// 직군정보 변경페이지로 이동
private fun ChangeJobInterest() {
Expand Down Expand Up @@ -102,4 +173,5 @@ class ProfileActivity : AppCompatActivity() {

}
}

}
11 changes: 8 additions & 3 deletions app/src/main/res/layout/activity_job_group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

<ImageButton
android:id="@+id/ibtn_job_change_back"
android:layout_width="9dp"
android:layout_height="18dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@null"
android:scaleType="fitCenter"
Expand Down Expand Up @@ -57,6 +57,7 @@
android:text="@string/mypage_user_id"
android:textColor="@color/main_pink"
android:textSize="20sp"
android:fontFamily="@font/pretendard_medium"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -69,6 +70,7 @@
android:text="@string/job_change_instruction1"
android:textColor="@color/black"
android:textSize="20sp"
android:fontFamily="@font/pretendard_medium"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_job_user_name"
app:layout_constraintBottom_toTopOf="@+id/tv_job_change_guide2"/>
Expand All @@ -82,6 +84,7 @@
android:text="@string/job_change_instruction2"
android:textColor="@color/black"
android:textSize="20sp"
android:fontFamily="@font/pretendard_medium"
app:layout_constraintTop_toBottomOf="@+id/ll_job_change_guide"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -94,6 +97,7 @@
android:text="@string/job_change_instruction3"
android:textColor="@color/gray_5"
android:textSize="14sp"
android:fontFamily="@font/pretendard_regular"
android:layout_marginTop="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down Expand Up @@ -135,7 +139,8 @@
android:text="@string/job_change_complete"
android:textColor="@color/white"
android:textSize="16sp"
android:enabled="true" />
android:fontFamily="@font/pretendard_semi_bold"
android:enabled="false" />

</LinearLayout>

Expand Down
Loading