diff --git a/app/build.gradle b/app/build.gradle index 80a9a8f..5142906 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -108,4 +108,7 @@ dependencies { implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion" kapt "com.github.bumptech.glide:compiler:$rootProject.glideVersion" + // Ballon layout + implementation "com.github.skydoves:balloon:1.4.2" + } \ No newline at end of file diff --git a/app/src/main/java/com/nexters/checkareer/presentation/ui/createprofile/CreateProfileFragment2.kt b/app/src/main/java/com/nexters/checkareer/presentation/ui/createprofile/CreateProfileFragment2.kt index 2c14cbf..79d829f 100644 --- a/app/src/main/java/com/nexters/checkareer/presentation/ui/createprofile/CreateProfileFragment2.kt +++ b/app/src/main/java/com/nexters/checkareer/presentation/ui/createprofile/CreateProfileFragment2.kt @@ -10,12 +10,14 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast +import androidx.core.content.ContextCompat import androidx.core.widget.addTextChangedListener import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs +import com.nexters.checkareer.R import com.nexters.checkareer.data.adapter.db.data.UserProfile import com.nexters.checkareer.databinding.CreateProfileFrag2Binding import com.nexters.checkareer.domain.skill.Skill @@ -24,6 +26,7 @@ import com.nexters.checkareer.presentation.ui.createprofile.listener.SkillCatego import com.nexters.checkareer.presentation.ui.createprofile.model.CategorySelect import com.nexters.checkareer.presentation.ui.home.HomeActivity import com.nexters.checkareer.presentation.ui.home.adapter.MySkillAdapter +import com.skydoves.balloon.* import dagger.hilt.android.AndroidEntryPoint import timber.log.Timber @@ -32,6 +35,7 @@ class CreateProfileFragment2 : Fragment() { private val viewModel by viewModels() private val args: CreateProfileFragment2Args by navArgs() + private lateinit var profileImageDescriptionBalloon: Balloon private lateinit var viewDataBinding: CreateProfileFrag2Binding @@ -50,6 +54,8 @@ class CreateProfileFragment2 : Fragment() { setupMySkillAdapter() setupEditTextEvent() setEvents() + setProfileInformation() + setProfileDescriptionBalloon() viewDataBinding.imageviewBack.setOnClickListener { findNavController().popBackStack() @@ -66,6 +72,42 @@ class CreateProfileFragment2 : Fragment() { } } + private fun setProfileInformation() { + viewModel.selectedSkillItems.observe(viewLifecycleOwner) { + if(it.size in 0..3) { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_1) + viewDataBinding.textviewProfileDescription.text = getString(R.string.skill_level_1) + } else if(it.size in 4..7) { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_2) + viewDataBinding.textviewProfileDescription.text = getString(R.string.skill_level_2) + } else { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_3) + viewDataBinding.textviewProfileDescription.text = getString(R.string.skill_level_3) + } + } + } + + private fun setProfileDescriptionBalloon() { + profileImageDescriptionBalloon = Balloon.Builder(requireContext()) + .setLayout(R.layout.profile_description_item) + .setArrowOrientation(ArrowOrientation.TOP) + .setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR) + .setWidthRatio(1f) + .setMarginLeft(20) + .setMarginRight(20) + .setCornerRadius(10f) + .setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.white)) + .setBalloonAnimation(BalloonAnimation.OVERSHOOT) + .setLifecycleOwner(viewLifecycleOwner) + .build() + + + + viewDataBinding.imageviewProfileDescription.setOnClickListener { + viewDataBinding.imageviewProfileDescription.showAlignBottom(profileImageDescriptionBalloon) + } + } + private fun setEvents() { viewModel.goHome.observe(this.viewLifecycleOwner) { val intent = Intent(requireContext(), HomeActivity::class.java) diff --git a/app/src/main/java/com/nexters/checkareer/presentation/ui/editprofile/EditProfileFragment.kt b/app/src/main/java/com/nexters/checkareer/presentation/ui/editprofile/EditProfileFragment.kt index 47fb4e3..ec0eb6f 100644 --- a/app/src/main/java/com/nexters/checkareer/presentation/ui/editprofile/EditProfileFragment.kt +++ b/app/src/main/java/com/nexters/checkareer/presentation/ui/editprofile/EditProfileFragment.kt @@ -11,11 +11,13 @@ import android.widget.Toast import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContract import androidx.activity.result.contract.ActivityResultContracts +import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.nexters.checkareer.R import com.nexters.checkareer.databinding.EditProfileFragBinding import com.nexters.checkareer.domain.vo.SkillTree import com.nexters.checkareer.presentation.ui.editprofile.adapter.MySkillEditAdapter @@ -26,6 +28,7 @@ import com.nexters.checkareer.presentation.ui.editprofile.listener.ItemDragListe import com.nexters.checkareer.presentation.ui.editprofile.skillorder.ChangeSkillOrderActivity import com.nexters.checkareer.presentation.ui.editprofile.util.ItemTouchHelperCallback import com.nexters.checkareer.presentation.ui.home.adapter.MySkillAdapter +import com.skydoves.balloon.* import dagger.hilt.android.AndroidEntryPoint @@ -35,6 +38,7 @@ class EditProfileFragment : Fragment(), SkillEditListener { private val viewModel by activityViewModels() private lateinit var viewDataBinding: EditProfileFragBinding + private lateinit var profileImageDescriptionBalloon: Balloon private lateinit var startActivityForResult: ActivityResultLauncher private lateinit var editSkillAdapter: MySkillEditAdapter private lateinit var addSkillBottomSheet: BottomSheetDialogFragment @@ -59,6 +63,8 @@ class EditProfileFragment : Fragment(), SkillEditListener { setupMySkillAdapter() setupMySkillTopThreeAdapter() setEvents() + setProfileInformation() + setProfileDescriptionBalloon() } @@ -79,6 +85,42 @@ class EditProfileFragment : Fragment(), SkillEditListener { } } + private fun setProfileInformation() { + viewModel.profile.observe(viewLifecycleOwner) { + if(it?.skills?.size in 0..3) { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_1) + viewDataBinding.textviewProfileDescription.text = getString(R.string.skill_level_1) + } else if(it?.skills?.size in 4..7) { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_2) + viewDataBinding.textviewProfileDescription.text = getString(R.string.skill_level_2) + } else { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_3) + viewDataBinding.textviewProfileDescription.text = getString(R.string.skill_level_3) + } + } + } + + private fun setProfileDescriptionBalloon() { + profileImageDescriptionBalloon = Balloon.Builder(requireContext()) + .setLayout(R.layout.profile_description_item) + .setArrowOrientation(ArrowOrientation.TOP) + .setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR) + .setWidthRatio(1f) + .setMarginLeft(20) + .setMarginRight(20) + .setCornerRadius(10f) + .setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.white)) + .setBalloonAnimation(BalloonAnimation.OVERSHOOT) + .setLifecycleOwner(viewLifecycleOwner) + .build() + + + + viewDataBinding.imageviewProfileDescription.setOnClickListener { + viewDataBinding.imageviewProfileDescription.showAlignBottom(profileImageDescriptionBalloon) + } + } + private fun setupBackButton() { viewDataBinding.imageviewBack.setOnClickListener { requireActivity().finish() diff --git a/app/src/main/java/com/nexters/checkareer/presentation/ui/home/HomeFragment2.kt b/app/src/main/java/com/nexters/checkareer/presentation/ui/home/HomeFragment2.kt index 05f9b1a..6127a82 100644 --- a/app/src/main/java/com/nexters/checkareer/presentation/ui/home/HomeFragment2.kt +++ b/app/src/main/java/com/nexters/checkareer/presentation/ui/home/HomeFragment2.kt @@ -5,14 +5,18 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels +import androidx.lifecycle.lifecycleScope +import com.nexters.checkareer.R import com.nexters.checkareer.databinding.HomeFrag2Binding import com.nexters.checkareer.presentation.ui.createprofile.CreateProfileActivity import com.nexters.checkareer.presentation.ui.editprofile.EditProfileActivity import com.nexters.checkareer.presentation.ui.home.adapter.MySkillAdapter import com.nexters.checkareer.presentation.ui.home.adapter.skill.SkillTreeAdapter import com.nexters.checkareer.presentation.ui.home.adapter.skill.SkillTreeViewType +import com.skydoves.balloon.* import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint @@ -22,6 +26,8 @@ class HomeFragment2 : Fragment() { private lateinit var viewDataBinding: HomeFrag2Binding + private lateinit var profileImageDescriptionBalloon: Balloon + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { viewDataBinding = HomeFrag2Binding.inflate(inflater, container, false).apply { viewmodel = viewModel @@ -38,6 +44,8 @@ class HomeFragment2 : Fragment() { setupLifecycleOwner() setupMySkillAdapter() setupMySkillTopThreeAdapter() + setProfileImage() + setProfileDescriptionBalloon() } private fun setupProfileEditButton() { @@ -46,6 +54,39 @@ class HomeFragment2 : Fragment() { } } + private fun setProfileImage() { + viewModel.profile.observe(viewLifecycleOwner) { + if(it.skills.size in 0..3) { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_1) + } else if(it.skills.size in 4..7) { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_2) + } else { + viewDataBinding.profileImage.setImageResource(R.drawable.image_tree_3) + } + } + } + + private fun setProfileDescriptionBalloon() { + profileImageDescriptionBalloon = Balloon.Builder(requireContext()) + .setLayout(R.layout.profile_description_item) + .setArrowOrientation(ArrowOrientation.TOP) + .setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR) + .setWidthRatio(1f) + .setMarginLeft(20) + .setMarginRight(20) + .setCornerRadius(10f) + .setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.white)) + .setBalloonAnimation(BalloonAnimation.OVERSHOOT) + .setLifecycleOwner(viewLifecycleOwner) + .build() + + + + viewDataBinding.imageviewProfileDescription.setOnClickListener { + viewDataBinding.imageviewProfileDescription.showAlignBottom(profileImageDescriptionBalloon) + } + } + /*private fun setupProfileDeleteButton() { viewDataBinding.imageviewDelete.setOnClickListener { val mDialogView = LayoutInflater.from(requireContext()).inflate(R.layout.confirm_dialog, null) diff --git a/app/src/main/res/drawable-v24/image_tree_1.png b/app/src/main/res/drawable-v24/image_tree_1.png new file mode 100644 index 0000000..391c93f Binary files /dev/null and b/app/src/main/res/drawable-v24/image_tree_1.png differ diff --git a/app/src/main/res/drawable-v24/image_tree_2.png b/app/src/main/res/drawable-v24/image_tree_2.png new file mode 100644 index 0000000..277340f Binary files /dev/null and b/app/src/main/res/drawable-v24/image_tree_2.png differ diff --git a/app/src/main/res/drawable-v24/image_tree_3.png b/app/src/main/res/drawable-v24/image_tree_3.png new file mode 100644 index 0000000..919525b Binary files /dev/null and b/app/src/main/res/drawable-v24/image_tree_3.png differ diff --git a/app/src/main/res/drawable/ic_question_mark.xml b/app/src/main/res/drawable/ic_question_mark.xml new file mode 100644 index 0000000..94242b4 --- /dev/null +++ b/app/src/main/res/drawable/ic_question_mark.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/layout/create_profile_frag_2.xml b/app/src/main/res/layout/create_profile_frag_2.xml index 82fa187..59e08b0 100644 --- a/app/src/main/res/layout/create_profile_frag_2.xml +++ b/app/src/main/res/layout/create_profile_frag_2.xml @@ -98,21 +98,61 @@ android:orientation="vertical" android:padding="10dp"> + + + + + + + + + + + + android:requiresFadingEdge="horizontal" /> diff --git a/app/src/main/res/layout/edit_profile_frag.xml b/app/src/main/res/layout/edit_profile_frag.xml index acdd515..dd8c354 100644 --- a/app/src/main/res/layout/edit_profile_frag.xml +++ b/app/src/main/res/layout/edit_profile_frag.xml @@ -86,22 +86,62 @@ android:paddingEnd="@dimen/margin_8dp" android:paddingBottom="@dimen/margin_normal"> + + + + + + + + + + + + + android:layout_width="match_parent" + android:layout_height="150dp" + android:layout_gravity="center" + tools:src="@drawable/image_tree_1" /> - + + + + + + + + + android:layout_marginTop="10dp" + android:orientation="horizontal"> + + + + + + + +