Skip to content

Commit

Permalink
Merge pull request #32 from tukcomCD2024/feat/#26_UI-3
Browse files Browse the repository at this point in the history
Feat : home UI 구현 #26
  • Loading branch information
hangunhee39 authored Jan 15, 2024
2 parents cc351d8 + 2d17a44 commit 7b104db
Show file tree
Hide file tree
Showing 28 changed files with 890 additions and 83 deletions.
9 changes: 9 additions & 0 deletions frontend/ARchive/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ plugins {
id 'dagger.hilt.android.plugin'
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

android {
namespace 'com.droidblossom.archive'
compileSdk 33
Expand All @@ -18,6 +21,8 @@ android {
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

manifestPlaceholders = [NAVER_CLIENT_ID: properties['naver_client_id']]
}

buildTypes {
Expand All @@ -36,6 +41,7 @@ android {
buildFeatures{
dataBinding = true
viewBinding = true
buildConfig = true
}
}

Expand Down Expand Up @@ -102,6 +108,9 @@ dependencies {

//circleIndicator : https://github.com/ongakuer/CircleIndicator
implementation 'me.relex:circleindicator:2.1.6'

//네이버 지도 : https://navermaps.github.io/android-map-sdk/guide-ko/1.html
implementation 'com.naver.maps:map-sdk:3.17.0'
}
kapt {
correctErrorTypes true
Expand Down
24 changes: 16 additions & 8 deletions frontend/ARchive/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<application
android:name=".ARchiveApplication"
Expand All @@ -17,7 +19,11 @@
android:theme="@style/Theme.ARchive"
android:usesCleartextTraffic="true"
tools:targetApi="31">


<meta-data
android:name="com.naver.maps.map.CLIENT_ID"
android:value="${NAVER_CLIENT_ID}" />

<activity
android:name=".presentation.ui.capsule.CapsuleDetailActivity"
android:exported="false"
Expand All @@ -40,7 +46,15 @@
android:name=".presentation.ui.MainActivity"
android:exported="true"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity"/>
tools:ignore="LockedOrientationActivity">


<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".presentation.ui.auth.AuthActivity"
Expand All @@ -50,14 +64,8 @@

<activity
android:name=".presentation.ui.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.droidblossom.archive.presentation.snack

import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import com.droidblossom.archive.R
import com.droidblossom.archive.databinding.SnackbarHomeAlertWithImageBinding
import com.google.android.material.snackbar.Snackbar

class HomeSnackBarBig(private val view : View, private val message: String, private val imgUrl : String) {

private val context = view.context
private val snackBar = Snackbar.make(view, "", 5000)
private val snackBarLayout = snackBar.view as Snackbar.SnackbarLayout
private val inflater = LayoutInflater.from(context)
private val snackBarBinding: SnackbarHomeAlertWithImageBinding = DataBindingUtil.inflate(inflater, R.layout.snackbar_home_alert_with_image, null, false)


init {
initView()
initData()
}

private fun initView() {
val location = view.findViewById<View>(R.id.place)

with(snackBarLayout) {
removeAllViews()
setPadding(0, 0, 0, 70)
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent))
addView(snackBarBinding.root, 0)
}
snackBar.anchorView = location
}

private fun initData() {
snackBarBinding.openBtn.setOnClickListener {
Toast.makeText(context,"테스트2", Toast.LENGTH_SHORT).show()
}
}

fun show() {
snackBar.show()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.droidblossom.archive.presentation.snack


import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import com.droidblossom.archive.R
import com.droidblossom.archive.databinding.SnackbarHomeAlertBinding
import com.google.android.material.snackbar.Snackbar


class HomeSnackBarSmall(private val view :View) {

private val context = view.context
private val snackBar = Snackbar.make(view, "", 5000)
private val snackBarLayout = snackBar.view as Snackbar.SnackbarLayout
private val inflater = LayoutInflater.from(context)
private val snackBarBinding: SnackbarHomeAlertBinding = DataBindingUtil.inflate(inflater, com.droidblossom.archive.R.layout.snackbar_home_alert, null, false)


init {
initView()
initData()
}

private fun initView() {
val location = view.findViewById<View>(R.id.place)

with(snackBarLayout) {
removeAllViews()
setPadding(0, 0, 0, 70)
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent))
addView(snackBarBinding.root, 0)
}
snackBar.anchorView = location
}

private fun initData() {
snackBarBinding.openBtn.setOnClickListener {
Toast.makeText(context,"테스트1",Toast.LENGTH_SHORT).show()
}
}

fun show() {
snackBar.show()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Bundle
import androidx.navigation.NavOptions
import androidx.navigation.findNavController
import androidx.navigation.ui.NavigationUI
import com.droidblossom.archive.BuildConfig
import com.droidblossom.archive.R
import com.droidblossom.archive.databinding.ActivityMainBinding
import com.droidblossom.archive.presentation.base.BaseActivity
Expand All @@ -15,6 +16,7 @@ import dagger.hilt.android.AndroidEntryPoint
class MainActivity : BaseActivity<Nothing?, ActivityMainBinding>(R.layout.activity_main) {

override val viewModel: Nothing? = null
lateinit var viewBinding: ActivityMainBinding

override fun observeData() {}

Expand All @@ -25,6 +27,8 @@ class MainActivity : BaseActivity<Nothing?, ActivityMainBinding>(R.layout.activi
val navController = findNavController(R.id.mainNavHost)
NavigationUI.setupWithNavController(binding.bottomNavigation, findNavController(R.id.mainNavHost))

viewBinding = binding

binding.fab.setOnClickListener {
navController.navigate(
R.id.cameraFragment, null, NavOptions.Builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
package com.droidblossom.archive.presentation.ui.home

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.droidblossom.archive.R
import com.droidblossom.archive.databinding.FragmentHomeBinding
import com.droidblossom.archive.presentation.base.BaseFragment
import com.droidblossom.archive.presentation.snack.HomeSnackBarBig
import com.droidblossom.archive.presentation.snack.HomeSnackBarSmall
import com.droidblossom.archive.presentation.ui.home.createcapsule.CreateCapsuleActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

/**
* A simple [Fragment] subclass.
* Use the [HomeFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class HomeFragment : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
@AndroidEntryPoint
class HomeFragment : BaseFragment<HomeViewModelImpl, FragmentHomeBinding>(R.layout.fragment_home) {

override val viewModel: HomeViewModelImpl by viewModels<HomeViewModelImpl>()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.vm = viewModel

binding.makeGroupCapsuleBtn.setOnClickListener {
//그룹 캡슐 생성 페이지로 이동
startActivity(CreateCapsuleActivity.newIntent(requireContext(),true))
}
binding.makeOpenCapsuleBtn.setOnClickListener {
//공개 캡슐 생성 페이지로 이동
startActivity(CreateCapsuleActivity.newIntent(requireContext(),false))
}
binding.makeSecretCapsuleBtn.setOnClickListener {
//그룹 캡슐 생성 페이지로 이동
startActivity(CreateCapsuleActivity.newIntent(requireContext(),false))
}

binding.snackbarTestBtn.setOnClickListener {
//스낵바 스몰 테스트용
HomeSnackBarSmall(requireView()).show()
}

binding.snackbarBigText.setOnClickListener {
//스낵바 빅 테스트용
HomeSnackBarBig(requireView(), "", "").show()
}
}

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_home, container, false)
}

companion object {
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment HomeFragment.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
HomeFragment().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
override fun observeData() {
//FAB 상태
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.filterCapsuleSelect.collect(

)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.droidblossom.archive.presentation.ui.home

import kotlinx.coroutines.flow.StateFlow

interface HomeViewModel {

val filterCapsuleSelect : StateFlow<CapsuleFilter>
val isClickedFAB : StateFlow<Boolean>
val existsNotification : StateFlow<Boolean>
val followLocation : StateFlow<Boolean>


fun selectPublic()
fun selectGroup()
fun selectSecret()
fun selectHotPlace()
fun clickFollowBtn()
fun clickNotificationBtn()
fun clickFAB()
enum class CapsuleFilter{
ALL,
SECRET,
PUBLIC,
GROUP,
HOT
}
}
Loading

0 comments on commit 7b104db

Please sign in to comment.