Skip to content

Commit

Permalink
feat: MyPage와 Setting 화면 연결 및 툴바 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
inseonyun committed Aug 8, 2023
1 parent c62b486 commit 0dad5d5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.fragment.app.viewModels
import com.created.team201.R
import com.created.team201.databinding.FragmentMyPageBinding
import com.created.team201.presentation.common.BindingFragment
import com.created.team201.presentation.setting.SettingActivity

class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_my_page) {
private val myPageViewModel: MyPageViewModel by viewModels {
Expand All @@ -29,6 +30,7 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
when (it.itemId) {
R.id.menu_my_page_setting -> {
// 설정 뷰 이동
startActivity(SettingActivity.getIntent(requireContext()))
true
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
package com.created.team201.presentation.setting

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.MenuItem
import com.created.team201.R
import com.created.team201.databinding.ActivitySettingBinding
import com.created.team201.presentation.common.BindingActivity

class SettingActivity : BindingActivity<ActivitySettingBinding>(R.layout.activity_setting) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initActionBar()
}

private fun initActionBar() {
setSupportActionBar(binding.tbSetting)
supportActionBar?.setHomeActionContentDescription(R.string.toolbar_back_text)
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_back)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
android.R.id.home -> {
finish()
true
}

else -> false
}

companion object {
fun getIntent(context: Context): Intent = Intent(context, SettingActivity::class.java)
}
}

0 comments on commit 0dad5d5

Please sign in to comment.