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

#318 [feat] 마이페이지 알림 설정창으로 보내는 로직 구현 #319

Merged
merged 3 commits into from
Jun 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.view.View
import androidx.fragment.app.viewModels
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
Expand All @@ -20,6 +21,7 @@ import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_my_page) {
private val myPageViewModel: MyPageViewModel by viewModels()
private val notificationPermissionRequestCode = 101

override fun onResume() {
super.onResume()
Expand All @@ -29,6 +31,7 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.viewModel = myPageViewModel
initNotificationBtnClickListener()
initBlockBtnClickListener()
initWithdrawBtnClickListener()
initLogoutBtnClickListener()
Expand All @@ -39,6 +42,15 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
initOpenSourceClickListener()
}

private fun initNotificationBtnClickListener() {
binding.tvMyPageNotification.setSingleOnClickListener {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.fromParts("package", requireContext().packageName, null)
}
requireContext().startActivity(intent)
}
}

private fun initBlockBtnClickListener() {
binding.tvMyPageBlock.setSingleOnClickListener {
startActivity(Intent(requireActivity(), BlockedUserActivity::class.java))
Expand Down
28 changes: 25 additions & 3 deletions app/src/main/res/layout/fragment_my_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,41 @@
</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tv_my_page_block"
android:id="@+id/tv_my_page_notification"
style="@style/H2Md"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="9dp"
android:paddingVertical="16dp"
android:text="@string/my_page_block"
android:text="@string/my_page_notification"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_my_page_rect" />

<View
android:id="@+id/view_my_page_notification"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/peeka_g_1"
app:layout_constraintEnd_toEndOf="@id/tv_my_page_notification"
app:layout_constraintStart_toStartOf="@id/tv_my_page_notification"
app:layout_constraintTop_toBottomOf="@id/tv_my_page_notification" />

<TextView
android:id="@+id/tv_my_page_block"
style="@style/H2Md"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:paddingVertical="16dp"
android:text="@string/my_page_block"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_my_page_notification" />

<View
android:id="@+id/view_my_page_block"
android:layout_width="0dp"
Expand Down Expand Up @@ -241,4 +263,4 @@
app:layout_constraintTop_toBottomOf="@id/tv_my_page_withdraw" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</layout>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<!-- MyPage -->
<string name="my_page_name">북과픽</string>
<string name="my_page_intro">안녕하세요. 저는 북과픽입니다.</string>
<string name="my_page_notification">알림 설정</string>
<string name="my_page_block">차단사용자 관리하기</string>
<string name="my_page_policy"><![CDATA[개인정보 보호 정책 & 서비스 이용 약관]]></string>
<string name="my_page_ask">문의하기</string>
Expand Down Expand Up @@ -218,4 +219,4 @@
<string name="force_update_title">앗! 피카북이 달라졌어요</string>
<string name="force_update_button">업데이트 하러 가기</string>
<string name="force_update_store_link">https://play.google.com/store/apps/details?id=com.sopt.peekabookaos&amp;hl=ko-KR</string>
</resources>
</resources>
Loading