diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7f853ad1..4c16f9e2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,6 +17,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.YouDongKnowMe"> + diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/standard/base/BaseActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/standard/base/BaseActivity.kt index 081d450d..54436936 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/standard/base/BaseActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/standard/base/BaseActivity.kt @@ -38,7 +38,7 @@ abstract class BaseActivity : AppCompatA spanTextView: TextView, startIdx: Int, endIdx: Int - ){ + ) { SpannableStringBuilder(spanTextView.text).apply { setSpan( ForegroundColorSpan(getColor(com.dongyang.android.youdongknowme.R.color.main)), diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/KeywordActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/KeywordActivity.kt index c296505b..e0db4e26 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/KeywordActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/KeywordActivity.kt @@ -6,7 +6,7 @@ import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.data.local.entity.KeywordEntity import com.dongyang.android.youdongknowme.databinding.ActivityKeywordBinding import com.dongyang.android.youdongknowme.standard.base.BaseActivity -import com.dongyang.android.youdongknowme.ui.view.main.MainActivity +import com.dongyang.android.youdongknowme.ui.view.permission.OnboardingPermissionActivity import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup import org.koin.androidx.viewmodel.ext.android.viewModel @@ -16,10 +16,8 @@ class KeywordActivity : BaseActivity() override val layoutResourceId: Int = R.layout.activity_keyword override val viewModel: KeywordViewModel by viewModel() - override fun initStartView() { - binding.vm = viewModel - } - + override fun initStartView() = Unit + override fun initDataBinding() { // 효율을 위해 단 한번만 옵저빙하여 이미 구독중인 항목을 선택 처리 viewModel.localKeywordList.observe(this, object : Observer> { @@ -47,7 +45,7 @@ class KeywordActivity : BaseActivity() viewModel.subscribeCheckedKeyword() if (viewModel.isFirstLaunch.value == true) { viewModel.setFirstLaunch(false) - val intent = Intent(this@KeywordActivity, MainActivity::class.java) + val intent = Intent(this@KeywordActivity, OnboardingPermissionActivity::class.java) startActivity(intent) } finish() diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/OnboardingKeywordActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/OnboardingKeywordActivity.kt index 44884533..8d2962c8 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/OnboardingKeywordActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/keyword/OnboardingKeywordActivity.kt @@ -20,7 +20,7 @@ class OnboardingKeywordActivity : BaseActivity() { + + override val layoutResourceId: Int = R.layout.activity_onboarding_permission + override val viewModel: SettingViewModel by viewModel() + + override fun initStartView() { + viewModel.setIsAccessSchoolAlarm(false) + viewModel.setIsAccessDepartAlarm(false) + + viewModel.checkAccessAlarm() + viewModel.getUserDepartment() + + setSpanText(binding.tvPermissionTitleMain,startIdx = 0, endIdx = 9) + } + + override fun initDataBinding() = Unit + + override fun initAfterBinding() { + binding.btnPermissionComplete.setOnClickListener { + val intent = Intent(this@OnboardingPermissionActivity, MainActivity::class.java) + startActivity(intent) + finish() + } + + binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> + if (compoundButton.isChecked) { + viewModel.setIsAccessSchoolAlarm(true) + viewModel.setIsAccessDepartAlarm(true) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.mvSwitchPermission.outlineAmbientShadowColor = getColor(R.color.blue300) + binding.mvSwitchPermission.outlineSpotShadowColor = getColor(R.color.blue300) + } + binding.switchPermission.setTextColor(getColor(R.color.blue300)) + } else { + viewModel.setIsAccessSchoolAlarm(false) + viewModel.setIsAccessDepartAlarm(false) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.mvSwitchPermission.outlineAmbientShadowColor = getColor(R.color.gray300) + binding.mvSwitchPermission.outlineSpotShadowColor = getColor(R.color.gray300) + } + binding.switchPermission.setTextColor(getColor(R.color.gray300)) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt index b57b50ad..1895cb2d 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt @@ -8,10 +8,10 @@ import com.dongyang.android.youdongknowme.standard.base.BaseViewModel /* 설정 뷰모델 */ class SettingViewModel(private val settingRepository: SettingRepository) : BaseViewModel() { - private val _isAccessSchoolAlarm: MutableLiveData = MutableLiveData(true) + private val _isAccessSchoolAlarm: MutableLiveData = MutableLiveData(false) val isAccessSchoolAlarm: LiveData get() = _isAccessSchoolAlarm - private val _isAccessDepartAlarm: MutableLiveData = MutableLiveData(true) + private val _isAccessDepartAlarm: MutableLiveData = MutableLiveData(false) val isAccessDepartAlarm: LiveData get() = _isAccessDepartAlarm private val _myDepartment: MutableLiveData = MutableLiveData() diff --git a/app/src/main/res/layout/activity_keyword.xml b/app/src/main/res/layout/activity_keyword.xml index 99320169..8f65da88 100644 --- a/app/src/main/res/layout/activity_keyword.xml +++ b/app/src/main/res/layout/activity_keyword.xml @@ -307,12 +307,4 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - - - - - /> - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_onboarding_permission.xml b/app/src/main/res/layout/activity_onboarding_permission.xml new file mode 100644 index 00000000..31542616 --- /dev/null +++ b/app/src/main/res/layout/activity_onboarding_permission.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 926ec0d3..d9e7218d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -47,6 +47,7 @@ 컴퓨터소프트웨어공학과 학과 설정 키워드 + 키워드 알림 설정 키워드 선택 앱 정보 문의하기 @@ -104,6 +105,9 @@ 처리중 + 키워드 알림 설정으로 + 중요한 공지사항을 놓치지 마세요! + 시작하기 키워드 알림함 편집