parent
8cee9fb019
commit
5daddc5fef
|
@ -11,7 +11,9 @@ object Constants {
|
|||
const val PREF_NO_CHAT_ROOM = "pref_no_chat"
|
||||
const val PREF_PUSH_TOKEN = "pref_push_token"
|
||||
const val PREF_PROFILE_IMAGE = "pref_profile_image"
|
||||
const val PREF_CONTENT_PREFERENCE = "pref_content_preference"
|
||||
const val PREF_IS_CONTENT_PLAY_LOOP = "pref_is_content_play_loop"
|
||||
const val PREF_IS_ADULT_CONTENT_VISIBLE = "pref_is_adult_content_visible"
|
||||
const val PREF_IS_FOLLOWED_CREATOR_LIVE = "pref_is_followed_creator_live"
|
||||
const val PREF_NOT_SHOWING_EVENT_POPUP_ID = "pref_not_showing_event_popup_id"
|
||||
const val PREF_IS_VIEWED_ON_BOARDING_TUTORIAL = "pref_is_viewed_on_boarding_tutorial"
|
||||
|
|
|
@ -95,6 +95,18 @@ object SharedPreferenceManager {
|
|||
sharedPreferences[Constants.PREF_IS_ADULT] = value
|
||||
}
|
||||
|
||||
var isAdultContentVisible: Boolean
|
||||
get() = sharedPreferences[Constants.PREF_IS_ADULT_CONTENT_VISIBLE, true]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_IS_ADULT_CONTENT_VISIBLE] = value
|
||||
}
|
||||
|
||||
var contentPreference: Int
|
||||
get() = sharedPreferences[Constants.PREF_CONTENT_PREFERENCE, 0]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_CONTENT_PREFERENCE] = value
|
||||
}
|
||||
|
||||
var pushToken: String
|
||||
get() = sharedPreferences[Constants.PREF_PUSH_TOKEN, ""]
|
||||
set(value) {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package kr.co.vividnext.sodalive.settings
|
||||
|
||||
enum class ContentType {
|
||||
// 전체
|
||||
ALL,
|
||||
|
||||
// 남성향
|
||||
MALE,
|
||||
|
||||
// 여성향
|
||||
FEMALE
|
||||
}
|
|
@ -4,10 +4,12 @@ import android.annotation.SuppressLint
|
|||
import android.content.Intent
|
||||
import android.graphics.Paint
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.activity.viewModels
|
||||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
||||
import kr.co.vividnext.sodalive.BuildConfig
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.base.SodaDialog
|
||||
|
@ -126,6 +128,42 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>(ActivitySettingsB
|
|||
binding.tvSignOut.setOnClickListener {
|
||||
startActivity(Intent(applicationContext, SignOutActivity::class.java))
|
||||
}
|
||||
|
||||
setupAdultContentVisibleView()
|
||||
}
|
||||
|
||||
private fun setupAdultContentVisibleView() {
|
||||
// 본인 인증 체크
|
||||
if (SharedPreferenceManager.isAuth) {
|
||||
binding.llAdultContentVisible.visibility = View.VISIBLE
|
||||
|
||||
// 19금 콘텐츠 보기 체크
|
||||
if (SharedPreferenceManager.isAdultContentVisible) {
|
||||
binding.llAdultContentPreference.visibility = View.VISIBLE
|
||||
|
||||
} else {
|
||||
binding.llAdultContentPreference.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 19금 콘텐츠 보기 스위치 액션
|
||||
binding.ivAdultContentVisible.setOnClickListener {
|
||||
viewModel.toggleAdultContentVisible()
|
||||
}
|
||||
|
||||
binding.tvContentAll.setOnClickListener {
|
||||
viewModel.setAdultContentPreference(ContentType.ALL)
|
||||
}
|
||||
|
||||
binding.tvContentMale.setOnClickListener {
|
||||
viewModel.setAdultContentPreference(ContentType.MALE)
|
||||
}
|
||||
|
||||
binding.tvContentFemale.setOnClickListener {
|
||||
viewModel.setAdultContentPreference(ContentType.FEMALE)
|
||||
}
|
||||
} else {
|
||||
binding.llAdultContentVisible.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun bindData() {
|
||||
|
@ -140,6 +178,29 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>(ActivitySettingsB
|
|||
viewModel.toastLiveData.observe(this) {
|
||||
it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() }
|
||||
}
|
||||
|
||||
viewModel.isAdultContentVisible.observe(this) {
|
||||
if (it) {
|
||||
binding.ivAdultContentVisible.setImageResource(R.drawable.btn_toggle_on_big)
|
||||
binding.llAdultContentPreference.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.ivAdultContentVisible.setImageResource(R.drawable.btn_toggle_off_big)
|
||||
binding.llAdultContentPreference.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.adultContentPreference.observe(this) {
|
||||
binding.tvContentAll.isSelected = false
|
||||
binding.tvContentMale.isSelected = false
|
||||
binding.tvContentFemale.isSelected = false
|
||||
|
||||
when (it) {
|
||||
ContentType.ALL -> binding.tvContentAll.isSelected = true
|
||||
ContentType.MALE -> binding.tvContentMale.isSelected = true
|
||||
ContentType.FEMALE -> binding.tvContentFemale.isSelected = true
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun logout() {
|
||||
|
|
|
@ -18,6 +18,20 @@ class SettingsViewModel(private val userRepository: UserRepository) : BaseViewMo
|
|||
val isLoading: LiveData<Boolean>
|
||||
get() = _isLoading
|
||||
|
||||
private var _isAdultContentVisible = MutableLiveData(
|
||||
SharedPreferenceManager.isAdultContentVisible
|
||||
)
|
||||
val isAdultContentVisible: LiveData<Boolean>
|
||||
get() = _isAdultContentVisible
|
||||
|
||||
private var _adultContentPreference = MutableLiveData(
|
||||
ContentType.values()[SharedPreferenceManager.contentPreference]
|
||||
)
|
||||
val adultContentPreference: LiveData<ContentType>
|
||||
get() = _adultContentPreference
|
||||
|
||||
var isChangedAdultContentVisible = false
|
||||
|
||||
fun logout(onSuccess: () -> Unit) {
|
||||
compositeDisposable.add(
|
||||
userRepository.logout(token = "Bearer ${SharedPreferenceManager.token}")
|
||||
|
@ -71,4 +85,17 @@ class SettingsViewModel(private val userRepository: UserRepository) : BaseViewMo
|
|||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun toggleAdultContentVisible() {
|
||||
val adultContentVisible = SharedPreferenceManager.isAdultContentVisible
|
||||
_isAdultContentVisible.value = !adultContentVisible
|
||||
SharedPreferenceManager.isAdultContentVisible = !adultContentVisible
|
||||
isChangedAdultContentVisible = true
|
||||
}
|
||||
|
||||
fun setAdultContentPreference(adultContentPreference: ContentType) {
|
||||
_adultContentPreference.value = adultContentPreference
|
||||
SharedPreferenceManager.contentPreference = adultContentPreference.ordinal
|
||||
isChangedAdultContentVisible = true
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 668 B After Width: | Height: | Size: 2.0 KiB |
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -219,9 +220,118 @@
|
|||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_forward" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_adult_content_visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="13.3dp"
|
||||
android:layout_marginTop="26.7dp"
|
||||
android:background="@drawable/bg_round_corner_6_7_222222"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="16.7dp"
|
||||
android:paddingStart="16.7dp"
|
||||
android:paddingEnd="13.3dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
android:text="19금 콘텐츠 보기"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="14.7sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_adult_content_visible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/btn_toggle_on_big" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_adult_content_preference"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginHorizontal="13.3dp"
|
||||
android:background="@color/color_88909090" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
android:paddingHorizontal="16.7dp"
|
||||
android:paddingTop="16.7dp"
|
||||
android:text="콘텐츠 유형"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="14.7sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="16.7dp"
|
||||
android:paddingVertical="13.3dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content_all"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawablePadding="13.3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:gravity="center_vertical"
|
||||
android:text="전체"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="13.3sp"
|
||||
app:drawableStartCompat="@drawable/ic_radio_button_select" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content_male"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawablePadding="13.3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:gravity="center_vertical"
|
||||
android:text="남성향"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="13.3sp"
|
||||
app:drawableStartCompat="@drawable/ic_radio_button_select" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content_female"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawablePadding="13.3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:gravity="center_vertical"
|
||||
android:text="여성향"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="13.3sp"
|
||||
app:drawableStartCompat="@drawable/ic_radio_button_select" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
|
|
Loading…
Reference in New Issue