diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/auth/ContentPreferenceBottomSheet.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/auth/ContentPreferenceBottomSheet.kt
new file mode 100644
index 00000000..04315ed4
--- /dev/null
+++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/auth/ContentPreferenceBottomSheet.kt
@@ -0,0 +1,86 @@
+package kr.co.vividnext.sodalive.v2.auth
+
+import android.app.Activity
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.Switch
+import androidx.core.view.AccessibilityDelegateCompat
+import androidx.core.view.ViewCompat
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat
+import com.google.android.material.bottomsheet.BottomSheetBehavior
+import com.google.android.material.bottomsheet.BottomSheetDialog
+import kr.co.vividnext.sodalive.R
+import kr.co.vividnext.sodalive.databinding.V2BottomSheetContentPreferenceBinding
+import kr.co.vividnext.sodalive.settings.ContentType
+
+class ContentPreferenceBottomSheet(
+ activity: Activity,
+ onToggle: () -> Unit,
+ onSelect: (ContentType) -> Unit,
+ onConfirm: () -> Unit
+) : BottomSheetDialog(activity, R.style.V2ContentPreferenceBottomSheetTheme) {
+
+ private val binding = V2BottomSheetContentPreferenceBinding.inflate(LayoutInflater.from(context))
+ private var isConfirmClicked = false
+
+ init {
+ setContentView(binding.root)
+ setCancelable(false)
+ setCanceledOnTouchOutside(false)
+ behavior.isDraggable = false
+ behavior.isHideable = false
+ behavior.skipCollapsed = true
+ behavior.state = BottomSheetBehavior.STATE_EXPANDED
+
+ ViewCompat.setAccessibilityHeading(binding.tvTitle, true)
+ ViewCompat.setAccessibilityHeading(binding.tvPreferenceLabel, true)
+ ViewCompat.setAccessibilityPaneTitle(binding.root, context.getString(R.string.screen_content_settings_title))
+ ViewCompat.setAccessibilityDelegate(
+ binding.toggleAdultContent,
+ object : AccessibilityDelegateCompat() {
+ override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfoCompat) {
+ super.onInitializeAccessibilityNodeInfo(host, info)
+ info.className = Switch::class.java.name
+ info.isCheckable = true
+ info.isChecked = binding.toggleAdultContent.isChecked
+ }
+ }
+ )
+
+ binding.toggleAdultContent.setOnClickListener { onToggle() }
+ binding.radioAll.setOnClickListener { onSelect(ContentType.ALL) }
+ binding.radioMale.setOnClickListener { onSelect(ContentType.MALE) }
+ binding.radioFemale.setOnClickListener { onSelect(ContentType.FEMALE) }
+ binding.btnConfirm.setOnClickListener {
+ if (isConfirmClicked) return@setOnClickListener
+ isConfirmClicked = true
+ binding.btnConfirm.isEnabled = false
+ dismiss()
+ onConfirm()
+ }
+ }
+
+ fun render(isAdultContentVisible: Boolean, contentType: ContentType, selectionEnabled: Boolean) {
+ binding.toggleAdultContent.isChecked = isAdultContentVisible
+ binding.tvAdultDescription.setText(
+ if (isAdultContentVisible) {
+ R.string.v2_content_preference_adult_on_description
+ } else {
+ R.string.v2_content_preference_adult_off_description
+ }
+ )
+ binding.layoutPreference.visibility = if (isAdultContentVisible) View.VISIBLE else View.GONE
+ binding.radioContentType.check(
+ when (contentType) {
+ ContentType.ALL -> R.id.radio_all
+ ContentType.MALE -> R.id.radio_male
+ ContentType.FEMALE -> R.id.radio_female
+ }
+ )
+ binding.toggleAdultContent.isEnabled = selectionEnabled
+ binding.radioAll.isEnabled = selectionEnabled && isAdultContentVisible
+ binding.radioMale.isEnabled = selectionEnabled && isAdultContentVisible
+ binding.radioFemale.isEnabled = selectionEnabled && isAdultContentVisible
+ binding.btnConfirm.isEnabled = !isConfirmClicked
+ }
+}
diff --git a/app/src/main/res/drawable/v2_content_preference_background.xml b/app/src/main/res/drawable/v2_content_preference_background.xml
new file mode 100644
index 00000000..658092b2
--- /dev/null
+++ b/app/src/main/res/drawable/v2_content_preference_background.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/v2_content_preference_radio.xml b/app/src/main/res/drawable/v2_content_preference_radio.xml
new file mode 100644
index 00000000..6f3feb14
--- /dev/null
+++ b/app/src/main/res/drawable/v2_content_preference_radio.xml
@@ -0,0 +1,32 @@
+
+
+ -
+
+
-
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/v2_content_preference_switch.xml b/app/src/main/res/drawable/v2_content_preference_switch.xml
new file mode 100644
index 00000000..dfcc20c4
--- /dev/null
+++ b/app/src/main/res/drawable/v2_content_preference_switch.xml
@@ -0,0 +1,31 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/v2_bottom_sheet_content_preference.xml b/app/src/main/res/layout/v2_bottom_sheet_content_preference.xml
new file mode 100644
index 00000000..0f81fffa
--- /dev/null
+++ b/app/src/main/res/layout/v2_bottom_sheet_content_preference.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-en/v2_content_preference_strings.xml b/app/src/main/res/values-en/v2_content_preference_strings.xml
new file mode 100644
index 00000000..e04eb9ec
--- /dev/null
+++ b/app/src/main/res/values-en/v2_content_preference_strings.xml
@@ -0,0 +1,8 @@
+
+
+ You can view adult content after completing age verification
+ Adult content will not appear in lists or search results
+ Preferred content
+ You can change this anytime in My > Settings > Content viewing settings
+ Save settings
+
diff --git a/app/src/main/res/values-ja/v2_content_preference_strings.xml b/app/src/main/res/values-ja/v2_content_preference_strings.xml
new file mode 100644
index 00000000..1de14be3
--- /dev/null
+++ b/app/src/main/res/values-ja/v2_content_preference_strings.xml
@@ -0,0 +1,8 @@
+
+
+ 年齢認証完了後、成人向けコンテンツを表示できます
+ 成人向けコンテンツは一覧や検索に表示されません
+ 好みのコンテンツ
+ マイ > 設定 > コンテンツ表示設定でいつでも変更できます
+ 設定完了
+
diff --git a/app/src/main/res/values/v2_content_preference.xml b/app/src/main/res/values/v2_content_preference.xml
new file mode 100644
index 00000000..1a017bd1
--- /dev/null
+++ b/app/src/main/res/values/v2_content_preference.xml
@@ -0,0 +1,69 @@
+
+
+ 26dp
+ 54dp
+ 44dp
+ 1dp
+ 52dp
+ 22dp
+ 5dp
+ 26.1sp
+ 23.2sp
+ 17.4sp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/v2_content_preference_strings.xml b/app/src/main/res/values/v2_content_preference_strings.xml
new file mode 100644
index 00000000..9ceac670
--- /dev/null
+++ b/app/src/main/res/values/v2_content_preference_strings.xml
@@ -0,0 +1,8 @@
+
+
+ 성인인증 완료 후 성인 콘텐츠를 볼 수 있어요
+ 성인 콘텐츠가 목록과 검색에 노출되지 않아요
+ 선호 콘텐츠
+ 마이 > 설정 > 콘텐츠 보기 설정에서 언제든 바꿀 수 있어요
+ 설정 완료
+
diff --git a/app/src/test/java/kr/co/vividnext/sodalive/v2/auth/ContentPreferenceBottomSheetTest.kt b/app/src/test/java/kr/co/vividnext/sodalive/v2/auth/ContentPreferenceBottomSheetTest.kt
new file mode 100644
index 00000000..8fb0937a
--- /dev/null
+++ b/app/src/test/java/kr/co/vividnext/sodalive/v2/auth/ContentPreferenceBottomSheetTest.kt
@@ -0,0 +1,48 @@
+package kr.co.vividnext.sodalive.v2.auth
+
+import android.app.Application
+import android.os.Looper
+import android.view.MotionEvent
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import kr.co.vividnext.sodalive.R
+import kr.co.vividnext.sodalive.settings.ContentType
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.Robolectric
+import org.robolectric.RobolectricTestRunner
+import org.robolectric.Shadows.shadowOf
+import org.robolectric.annotation.Config
+
+@RunWith(RobolectricTestRunner::class)
+@Config(sdk = [28], application = Application::class)
+class ContentPreferenceBottomSheetTest {
+ @Test
+ fun `선택이 잠긴 GET 재시도도 완료 터치로 닫힌 뒤 확인을 한 번 전달한다`() {
+ val controller = Robolectric.buildActivity(AppCompatActivity::class.java)
+ controller.get().setTheme(R.style.Theme_SodaLive)
+ controller.setup()
+ var confirmations = 0
+ lateinit var sheet: ContentPreferenceBottomSheet
+ sheet = ContentPreferenceBottomSheet(controller.get(), {}, {}, {
+ assertFalse(sheet.isShowing)
+ confirmations += 1
+ })
+ sheet.render(true, ContentType.FEMALE, selectionEnabled = false)
+ sheet.show()
+ val confirm = sheet.findViewById(R.id.btn_confirm)!!
+ repeat(2) {
+ listOf(MotionEvent.ACTION_DOWN, MotionEvent.ACTION_UP).forEach { action ->
+ val event = MotionEvent.obtain(0, 10, action, 1f, 1f, 0)
+ confirm.dispatchTouchEvent(event)
+ event.recycle()
+ }
+ shadowOf(Looper.getMainLooper()).idle()
+ }
+ assertEquals(1, confirmations)
+ sheet.dismiss()
+ controller.pause().stop().destroy()
+ }
+}