Skip to content

Commit

Permalink
Merge pull request #456 from woowacourse-teams/AN/hotfix/451-studydet…
Browse files Browse the repository at this point in the history
…ail-inflate

[스터디 상세보기 뷰] 클릭안되는 버튼 로직 수정
  • Loading branch information
RightHennessy authored Sep 25, 2023
2 parents 4d577d7 + 15c3134 commit 2fdc0c4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ android {
applicationId "com.created.team201"
minSdk 26
targetSdk 33
versionCode 3
versionName "1.1.1"
versionCode 4
versionName "1.1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "TEAM201_GIT_HUB_URL", properties["GIT_HUB_URL"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ class ProfileActivity : BindingActivity<ActivityProfileBinding>(R.layout.activit
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_profile, menu)
val isMyProfile = intent.getBooleanExtra(KEY_MY_PROFILE, false)
when (isMyProfile) {
true -> binding.tbProfile.setTitle(R.string.myPage_toolbar_title)
false -> menuInflater.inflate(R.menu.menu_profile, menu)
}
return true
}

Expand All @@ -98,9 +102,11 @@ class ProfileActivity : BindingActivity<ActivityProfileBinding>(R.layout.activit
companion object {
private const val NON_EXISTENCE_USER_ID = 0L
private const val KEY_USER_ID = "KEY_USER_ID"
fun getIntent(context: Context, userId: Long): Intent =
private const val KEY_MY_PROFILE = "KEY_MY_PROFILE"
fun getIntent(context: Context, userId: Long, isMyProfile: Boolean = false): Intent =
Intent(context, ProfileActivity::class.java).apply {
putExtra(KEY_USER_ID, userId)
putExtra(KEY_MY_PROFILE, isMyProfile)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class StudyDetailActivity :
binding.btnStudyDetailSub.setOnClickListener {
if (studyDetailViewModel.state.value is Master) {
navigateToEditStudyView()
return@setOnClickListener
}
showToast(R.string.study_detail_button_preparing_service)
}
}

Expand Down Expand Up @@ -147,10 +149,8 @@ class StudyDetailActivity :
}

override fun onUserClick(memberId: Long) {
if (studyDetailViewModel.myProfile.id == memberId) {
return
}
startActivity(ProfileActivity.getIntent(this, memberId))
val isMyProfile = studyDetailViewModel.myProfile.id == memberId
startActivity(ProfileActivity.getIntent(this, memberId, isMyProfile))
}

private fun observeParticipantsCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,8 @@ class StudyManagementActivity :
toastDeletedMember()
return
}

if (studyManagementViewModel.myProfile.id == id) {
return
} else {
startActivity(ProfileActivity.getIntent(this@StudyManagementActivity, id))
}
val isMyProfile = studyManagementViewModel.myProfile.id == id
startActivity(ProfileActivity.getIntent(this@StudyManagementActivity, id, isMyProfile))
}
}

Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<string name="study_detail_study_people">스터디원</string>
<string name="study_detail_study_capacity">참여하기(%d/%d)</string>
<string name="study_detail_button_start_study">시작하기(%d/%d)</string>
<string name="study_detail_button_preparing_service">아직 준비중인 기능입니다</string>
<string name="study_detail_dm_button_content_description">스터디장에게 문의하기</string>
<string name="study_detail_study_accept_waiting">수락을 기다리고 있어요</string>
<string name="study_detail_study_start_waiting">시작을 기다리고 있어요</string>
Expand Down

0 comments on commit 2fdc0c4

Please sign in to comment.