-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/#63
- Loading branch information
Showing
29 changed files
with
815 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 42 additions & 3 deletions
45
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/OnboardingFinishActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,51 @@ | ||
package com.sopt.umbba_android.presentation.onboarding | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.os.Handler | ||
import android.os.Looper | ||
import android.view.View | ||
import android.view.animation.AnimationUtils | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.ActivityOnboardingFinishBinding | ||
import com.sopt.umbba_android.presentation.MainActivity | ||
import com.sopt.umbba_android.util.binding.BindingActivity | ||
|
||
class OnboardingFinishActivity : AppCompatActivity() { | ||
class OnboardingFinishActivity : BindingActivity<ActivityOnboardingFinishBinding>(R.layout.activity_onboarding_finish) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_onboarding_finish) | ||
|
||
goBack() | ||
animateFadeBackground() | ||
goMainActivity() | ||
} | ||
|
||
private fun goBack() { | ||
binding.btnBack2.setOnClickListener { | ||
finish() | ||
} | ||
} | ||
|
||
private fun animateFadeBackground() { | ||
Handler(Looper.getMainLooper()).postDelayed({ | ||
val fadeOutAnim = AnimationUtils.loadAnimation(this, R.anim.fadeout) | ||
with(binding.clStart) { | ||
startAnimation(fadeOutAnim) | ||
visibility = View.INVISIBLE | ||
} | ||
val fadeInAnim = AnimationUtils.loadAnimation(this, R.anim.fadein) | ||
binding.clArrive.startAnimation(fadeInAnim) | ||
with(binding.clArrive) { | ||
startAnimation(fadeInAnim) | ||
visibility = View.VISIBLE | ||
} | ||
},1000) | ||
|
||
} | ||
|
||
private fun goMainActivity() { | ||
binding.btnStart.setOnClickListener { | ||
startActivity(Intent(this, MainActivity::class.java)) | ||
} | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/QuestActivity.kt
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/QuestSubFragment.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package com.sopt.umbba_android.presentation.onboarding.quest | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.View | ||
import androidx.activity.viewModels | ||
import com.sopt.umbba_android.R | ||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.FragmentManager | ||
import androidx.fragment.app.commit | ||
import com.sopt.umbba_android.databinding.ActivityQuestBinding | ||
import com.sopt.umbba_android.presentation.onboarding.NotifyTimeActivity | ||
import com.sopt.umbba_android.presentation.onboarding.SetTimeActivity | ||
import com.sopt.umbba_android.util.binding.BindingActivity | ||
|
||
class QuestActivity : BindingActivity<ActivityQuestBinding>(R.layout.activity_quest), | ||
View.OnClickListener { | ||
|
||
private val viewModel by viewModels<QuestViewModel>() | ||
private var count = 0 | ||
private var quest = arrayOfNulls<String>(5) | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.viewmodel = viewModel | ||
binding.clickListener = this | ||
|
||
initFragment(QuestOneFragment()) | ||
checkNextButtonEnabled() | ||
clickNextButton() | ||
} | ||
|
||
override fun onClick(view: View?) { | ||
when (view?.id) { | ||
R.id.iv_basic_back -> { | ||
if (count in 1..4) { | ||
supportFragmentManager.popBackStack("$count", FragmentManager.POP_BACK_STACK_INCLUSIVE) | ||
binding.progressBar.progress -= 20 | ||
count -= 1 | ||
initChip() | ||
setBeforeButtonClick(count) | ||
} else { | ||
finish() | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun setBeforeButtonClick(count: Int) { | ||
when (quest[count].toString()) { | ||
"응" -> viewModel.isClickedYes.value = true | ||
"아니" -> viewModel.isClickedNo.value = true | ||
"애매해" -> viewModel.isClickedAmbiguous.value = true | ||
} | ||
Log.d("viewmodel", "pop stack : ${count}번 : ${quest[count].toString()}") | ||
} | ||
|
||
private fun initFragment(fragment: Fragment) { | ||
supportFragmentManager.beginTransaction() | ||
.add(R.id.fragment_question, fragment) | ||
.addToBackStack("$count") | ||
.commit() | ||
} | ||
|
||
private fun changeFragment(fragment: Fragment) { | ||
supportFragmentManager.commit { | ||
replace(R.id.fragment_question, fragment) | ||
.addToBackStack("$count") | ||
} | ||
} | ||
|
||
private fun checkNextButtonEnabled() { | ||
viewModel.isClickedComplete.observe(this) { | ||
binding.btnNext.isEnabled = true | ||
} | ||
} | ||
|
||
private fun clickNextButton() { | ||
binding.btnNext.setOnClickListener { | ||
Log.d("viewmodel", "chipText : ${viewModel.clickedChipText.value.toString()}") | ||
Log.d("viewmodel", "count : ${count}") | ||
quest[count] = viewModel.clickedChipText.value.toString() | ||
Log.d("viewmodel", "배열 값 : ${quest[count]}") | ||
initChip() | ||
count += 1 | ||
when (count) { | ||
0 -> changeFragment(QuestOneFragment()) | ||
1 -> changeFragment(QuestTwoFragment()) | ||
2 -> changeFragment(QuestThreeFragment()) | ||
3 -> changeFragment(QuestFourFragment()) | ||
4 -> changeFragment(QuestFiveFragment()) | ||
5 -> { | ||
goNextActivity() | ||
count = 4 | ||
} | ||
} | ||
binding.progressBar.progress += 20 | ||
} | ||
} | ||
|
||
private fun initChip() { | ||
with(viewModel) { | ||
isClickedYes.value = false | ||
isClickedNo.value = false | ||
isClickedAmbiguous.value = false | ||
} | ||
} | ||
|
||
private fun goNextActivity() { | ||
if (true) { //초대하는 측 | ||
startActivity(Intent(this, SetTimeActivity::class.java)) | ||
} else { //초대받는 측 | ||
startActivity(Intent(this, NotifyTimeActivity::class.java)) | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestFiveFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.sopt.umbba_android.presentation.onboarding.quest | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.activityViewModels | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.FragmentQuestFiveBinding | ||
import com.sopt.umbba_android.util.binding.BindingFragment | ||
|
||
class QuestFiveFragment : BindingFragment<FragmentQuestFiveBinding>(R.layout.fragment_quest_five) { | ||
private val viewModel by activityViewModels<QuestViewModel>() | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
binding.viewmodel = viewModel | ||
|
||
checkButtonComplete() | ||
} | ||
|
||
private fun checkButtonComplete() { | ||
viewModel.isClickedYes.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer1.text.toString() | ||
} | ||
viewModel.isClickedNo.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer2.text.toString() | ||
} | ||
viewModel.isClickedAmbiguous.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer3.text.toString() | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestFourFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.sopt.umbba_android.presentation.onboarding.quest | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.activityViewModels | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.FragmentQuestFourBinding | ||
import com.sopt.umbba_android.util.binding.BindingFragment | ||
|
||
class QuestFourFragment : BindingFragment<FragmentQuestFourBinding>(R.layout.fragment_quest_four) { | ||
private val viewModel by activityViewModels<QuestViewModel>() | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
binding.viewmodel = viewModel | ||
|
||
checkButtonComplete() | ||
} | ||
|
||
private fun checkButtonComplete() { | ||
viewModel.isClickedYes.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer1.text.toString() | ||
} | ||
viewModel.isClickedNo.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer2.text.toString() | ||
} | ||
viewModel.isClickedAmbiguous.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer3.text.toString() | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestOneFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.sopt.umbba_android.presentation.onboarding.quest | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.activityViewModels | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.FragmentQuestOneBinding | ||
import com.sopt.umbba_android.util.binding.BindingFragment | ||
|
||
class QuestOneFragment : BindingFragment<FragmentQuestOneBinding>(R.layout.fragment_quest_one) { | ||
|
||
private val viewModel by activityViewModels<QuestViewModel>() | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
binding.viewmodel = viewModel | ||
|
||
checkButtonComplete() | ||
} | ||
|
||
private fun checkButtonComplete() { | ||
viewModel.isClickedYes.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer1.text.toString() | ||
} | ||
viewModel.isClickedNo.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer2.text.toString() | ||
} | ||
viewModel.isClickedAmbiguous.observe(viewLifecycleOwner) { | ||
viewModel.checkButtonComplete() | ||
viewModel.clickedChipText.value = binding.btnAnswer3.text.toString() | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.