Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Setting 뷰 구현 #331

Merged
merged 5 commits into from
Sep 15, 2023
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
4 changes: 4 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".presentation.setting.SettingActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 수정을 완료한 뒤 확인차 한 번 실행해보면 좋을 것 같아요 🙏

android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.now.naaga.data.firebase.analytics.MYPAGE_GO_RESULTS
import com.now.naaga.data.firebase.analytics.MY_PAGE_STATISTICS
import com.now.naaga.databinding.ActivityMyPageBinding
import com.now.naaga.presentation.adventurehistory.AdventureHistoryActivity
import com.now.naaga.presentation.setting.SettingActivity

class MyPageActivity : AppCompatActivity(), AnalyticsDelegate by DefaultAnalyticsDelegate() {
private lateinit var binding: ActivityMyPageBinding
Expand Down Expand Up @@ -43,6 +44,10 @@ class MyPageActivity : AppCompatActivity(), AnalyticsDelegate by DefaultAnalytic
val intent = AdventureHistoryActivity.getIntent(this)
startActivity(intent)
}
binding.ivMypageSetting.setOnClickListener {
val intent = SettingActivity.getIntent(this)
startActivity(intent)
}
}

private fun fetchData() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.now.naaga.presentation.setting

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import com.now.naaga.databinding.ActivitySettingBinding

class SettingActivity : AppCompatActivity() {
private lateinit var binding: ActivitySettingBinding
private lateinit var viewModel: SettingViewModel

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySettingBinding.inflate(layoutInflater)
setContentView(binding.root)
initViewModel()
setClickListeners()
}

private fun initViewModel() {
viewModel = ViewModelProvider(this, SettingViewModel.Factory)[SettingViewModel::class.java]
binding.lifecycleOwner = this
}

private fun setClickListeners() {
binding.ivSettingBack.setOnClickListener {
finish()
}
}

companion object {
fun getIntent(context: Context): Intent {
return Intent(context, SettingActivity::class.java)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.now.naaga.presentation.setting

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.now.domain.repository.AuthRepository
import com.now.naaga.NaagaApplication.DependencyContainer.authDataSource
import com.now.naaga.data.repository.DefaultAuthRepository

class SettingViewModel(private val authRepository: AuthRepository) : ViewModel() {

companion object {
val Factory = SettingFactory(DefaultAuthRepository(authDataSource))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewModel이 Factory를 갖도록 하는 통일성 👍


class SettingFactory(private val authRepository: AuthRepository) :
ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return SettingViewModel(authRepository) as T
}
}
}
}
10 changes: 10 additions & 0 deletions android/app/src/main/res/drawable/ic_setting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="33dp"
android:viewportWidth="34"
android:viewportHeight="33">
<path
android:pathData="M21.192,1.078L20.589,0.825L20.115,1.277C19.066,2.279 18.378,2.876 17.864,3.207C17.379,3.519 17.183,3.507 17.065,3.485C16.849,3.444 16.556,3.288 15.915,2.836C15.805,2.759 15.689,2.676 15.565,2.587C15.015,2.194 14.314,1.692 13.415,1.146L12.972,0.876L12.496,1.083L8.765,2.71L8.063,3.015L8.175,3.772C8.35,4.962 8.235,5.796 8.004,6.375C7.778,6.943 7.417,7.327 6.983,7.594C6.066,8.156 4.774,8.213 3.821,8.039L3.047,7.898L2.728,8.617L1.086,12.313L0.738,13.096L1.459,13.56C2.55,14.262 3.12,14.929 3.397,15.493C3.664,16.041 3.689,16.556 3.566,17.051C3.304,18.112 2.345,19.122 1.444,19.724L0.749,20.188L1.083,20.954L2.725,24.724L3.027,25.417L3.776,25.316C6.353,24.967 7.404,25.747 7.871,26.515C8.416,27.41 8.421,28.682 8.192,29.635L7.989,30.479L8.796,30.799L12.527,32.278L13.216,32.55L13.677,31.971C15.295,29.941 16.674,29.713 17.656,29.935C18.763,30.186 19.73,31.085 20.271,31.901L20.726,32.586L21.486,32.272L25.068,30.794L25.784,30.498L25.677,29.731C25.517,28.58 25.642,27.755 25.886,27.166C26.128,26.583 26.511,26.169 26.975,25.87C27.942,25.246 29.276,25.125 30.235,25.243L31.032,25.342L31.301,24.586L32.718,20.594L32.97,19.885L32.359,19.447C31.441,18.788 30.97,18.159 30.746,17.616C30.525,17.082 30.514,16.559 30.642,16.048C30.911,14.972 31.8,13.966 32.596,13.374L33.254,12.885L32.904,12.144L31.262,8.669L30.933,7.972L30.174,8.114C28.955,8.342 28.095,8.256 27.493,8.04C26.904,7.829 26.5,7.472 26.215,7.034C25.612,6.108 25.52,4.774 25.675,3.78L25.795,3.007L25.073,2.704L21.192,1.078ZM18.946,4.889C19.532,4.512 20.202,3.939 21.02,3.174L23.619,4.263C23.561,5.443 23.751,6.915 24.539,8.125C25.043,8.9 25.787,9.553 26.819,9.923C27.655,10.222 28.636,10.321 29.771,10.195L30.765,12.299C29.919,13.079 29.039,14.214 28.701,15.562C28.483,16.437 28.494,17.403 28.897,18.379C29.222,19.166 29.781,19.911 30.593,20.603L29.669,23.204C28.516,23.188 27.089,23.417 25.891,24.189C25.121,24.685 24.452,25.404 24.039,26.4C23.706,27.202 23.557,28.143 23.619,29.228L21.435,30.129C20.674,29.232 19.527,28.308 18.097,27.985C16.338,27.587 14.421,28.152 12.598,30.154L10.288,29.239C10.417,28.096 10.31,26.676 9.58,25.476C8.659,23.962 6.928,23.073 4.267,23.256L3.232,20.88C4.172,20.1 5.16,18.939 5.508,17.531C5.734,16.618 5.684,15.616 5.193,14.614C4.804,13.82 4.162,13.071 3.248,12.373L4.255,10.106C5.399,10.187 6.829,10.034 8.028,9.299C8.801,8.824 9.464,8.115 9.862,7.116C10.183,6.309 10.316,5.357 10.238,4.249L12.813,3.127C13.434,3.522 13.938,3.882 14.385,4.202L14.385,4.202L14.385,4.202C14.515,4.295 14.64,4.384 14.762,4.47C15.35,4.884 15.984,5.315 16.692,5.45C17.498,5.603 18.22,5.356 18.946,4.889ZM10.826,16.674C10.826,13.488 13.546,10.826 17,10.826C20.454,10.826 23.174,13.488 23.174,16.674C23.174,19.86 20.454,22.522 17,22.522C13.546,22.522 10.826,19.86 10.826,16.674ZM17,8.826C12.53,8.826 8.826,12.296 8.826,16.674C8.826,21.052 12.53,24.522 17,24.522C21.47,24.522 25.174,21.052 25.174,16.674C25.174,12.296 21.47,8.826 17,8.826Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
10 changes: 10 additions & 0 deletions android/app/src/main/res/layout/activity_my_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/customGrid_mypage_statistics" />

<ImageView
android:id="@+id/iv_mypage_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_setting" />

</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</layout>
115 changes: 115 additions & 0 deletions android/app/src/main/res/layout/activity_setting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.setting.SettingActivity">

<ImageView
android:id="@+id/iv_setting_back"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id 규칙을 잘 지켜주셔서 좋네요👍

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:paddingHorizontal="16dp"
android:paddingVertical="12dp"
android:src="@drawable/ic_arrow"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<View
android:id="@+id/v_setting_first"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="28dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="28dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_setting_back" />

<TextView
android:id="@+id/tv_setting_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/pretendard_medium"
android:text="로그아웃"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v_setting_first" />

<View
android:id="@+id/v_setting_second"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="28dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="28dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_setting_logout" />

<TextView
android:id="@+id/tv_setting_unlink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/pretendard_medium"
android:text="회원 탈퇴"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/v_setting_second" />

<View
android:id="@+id/v_setting_third"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="28dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="28dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_setting_unlink" />

<TextView
android:id="@+id/tv_setting_inquiry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/pretendard_medium"
android:text="문의하기"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v_setting_third" />

<View
android:id="@+id/v_setting_fourth"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="28dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="28dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_setting_inquiry" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading