Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/com/myongsik/myongsikandroid/presentation/view/food/MapFragment.kt
#	app/src/main/java/com/myongsik/myongsikandroid/presentation/view/search/SearchFragment.kt
#	app/src/main/java/com/myongsik/myongsikandroid/presentation/viewmodel/food/SplashViewModel.kt
  • Loading branch information
kez-lab committed May 4, 2023
2 parents f2ea4b1 + bd08c92 commit 3557495
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 52 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
✔️ <b>2022년 11월 7일 Ver.2 (주변 식당 검색 및 추천, 찜꽁리스트기능)</b><br>
✔️ <b>2023년 3월 6일 Ver.3 (자연캠퍼스 식당 4곳 추가, 리뷰기능)</b><br>
✔️ <b>2023년 3월 27일 Ver.4 (홈화면 개편, 식당 찜꽁리스트 순위 기능 개발, 크래시대응)</b><br>
✔️ <b>2023년 4월 24일 Ver.5 (거리순, 랭킹순 식당조회, 맛집 지도, 위젯으로 식단 조회 기능 개발, 크래시대응)</b><br>
✔️ <b>기능 추가 및 유지보수 예정</b><br>

## 📌 기술 스택(Tech Skill)
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "com.myongsik.myongsikandroid"
minSdk 23
targetSdk 33
versionCode 24
versionName "2.2.9"
versionCode 25
versionName "2.2.10"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
16 changes: 9 additions & 7 deletions app/src/main/java/com/myongsik/myongsikandroid/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.NavigationUI
import com.myongsik.myongsikandroid.alarm.AlarmBroadCastReceiver
Expand All @@ -31,6 +32,10 @@ class MainActivity : AppCompatActivity() {
val navController = navHostFragment.navController
NavigationUI.setupWithNavController(binding.bottomNavigationView, navController)

binding.bottomNavigationView.setOnItemReselectedListener{
false
}

binding.bottomNavigationView.setOnItemSelectedListener {
when (it.itemId) {
R.id.fragment_home -> {
Expand All @@ -46,12 +51,12 @@ class MainActivity : AppCompatActivity() {
return@setOnItemSelectedListener true
}
R.id.fragment_search -> {
navController.navigate(R.id.fragment_search)
return@setOnItemSelectedListener true
navController.navigate(R.id.fragment_search)
return@setOnItemSelectedListener true
}
R.id.fragment_love -> {
navController.navigate(R.id.fragment_love)
return@setOnItemSelectedListener true
navController.navigate(R.id.fragment_love)
return@setOnItemSelectedListener true
}
// 다른 항목에 대한 처리 추가 가능
else -> {
Expand Down Expand Up @@ -87,7 +92,4 @@ class MainActivity : AppCompatActivity() {
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, triggerTime.timeInMillis, AlarmManager.INTERVAL_DAY, pIntent)

}



}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import com.myongsik.myongsikandroid.data.model.review.ResponseReviewData
import com.myongsik.myongsikandroid.data.model.user.RequestUserData
import com.myongsik.myongsikandroid.data.model.user.ResponseUserData
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.*

interface HomeFoodApi {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.myongsik.myongsikandroid.data.db

import androidx.lifecycle.LiveData
import androidx.paging.PagingData
import androidx.paging.PagingSource
import androidx.room.*
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.myongsik.myongsikandroid.presentation.view.food

import android.graphics.Bitmap
import android.graphics.Canvas
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -124,40 +125,47 @@ class MapFragment : BaseFragment<FragmentMapBinding>(), MapView.POIItemEventList
}

override fun onPOIItemSelected(p0: MapView?, p1: MapPOIItem) {
previouslySelectedMarker?.let { prevMarker ->
p0?.removePOIItem(prevMarker)

val originalBitmap = createCustomMarkerBitmap(prevMarker.itemName)
if (previouslySelectedMarker != null && previouslySelectedMarker?.tag == p1.tag) {
// 동일한 마커가 다시 클릭되었을 때
p0?.deselectPOIItem(p1)
previouslySelectedMarker = null
return
} else {
previouslySelectedMarker?.let { prevMarker ->
p0?.removePOIItem(prevMarker)

val originalBitmap = createCustomMarkerBitmap(prevMarker.itemName)

val restoredMarker = MapPOIItem().apply {
itemName = prevMarker.itemName
tag = prevMarker.tag
mapPoint = prevMarker.mapPoint
customImageBitmap = originalBitmap
markerType = MapPOIItem.MarkerType.CustomImage
setCustomImageAnchor(0.5f, 1.0f)
}

val restoredMarker = MapPOIItem().apply {
itemName = prevMarker.itemName
tag = prevMarker.tag
mapPoint = prevMarker.mapPoint
customImageBitmap = originalBitmap
p0?.addPOIItem(restoredMarker)
}
// 기존 마커를 지도에서 제거
p0?.removePOIItem(p1)
val selectedBitmap = createSelectedCustomMarkerBitmap(p1.itemName)

val newMarker = MapPOIItem().apply {
itemName = p1.itemName
tag = p1.tag
mapPoint = p1.mapPoint
customImageBitmap = selectedBitmap
markerType = MapPOIItem.MarkerType.CustomImage
setCustomImageAnchor(0.5f, 1.0f)
}

p0?.addPOIItem(restoredMarker)
}
// 기존 마커를 지도에서 제거
p0?.removePOIItem(p1)
val selectedBitmap = createSelectedCustomMarkerBitmap(p1.itemName)

val newMarker = MapPOIItem().apply {
itemName = p1.itemName
tag = p1.tag
mapPoint = p1.mapPoint
customImageBitmap = selectedBitmap
markerType = MapPOIItem.MarkerType.CustomImage
setCustomImageAnchor(0.5f, 1.0f)
}

p0?.addPOIItem(newMarker)
previouslySelectedMarker = newMarker
p0?.invalidate()
p0?.addPOIItem(newMarker)
previouslySelectedMarker = newMarker
p0?.invalidate()

showBottomSheetDialog(p1.tag)
showBottomSheetDialog(p1.tag)
}
}

private fun showBottomSheetDialog(restaurantId: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package com.myongsik.myongsikandroid.presentation.viewmodel.food
import androidx.datastore.preferences.core.Preferences
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.myongsik.myongsikandroid.data.model.food.*
import com.myongsik.myongsikandroid.BaseViewModel
import com.myongsik.myongsikandroid.data.model.food.RankRestaurantResponse
import com.myongsik.myongsikandroid.data.model.food.ResponseMealData
import com.myongsik.myongsikandroid.data.model.food.ResponseOneRestaurant
import com.myongsik.myongsikandroid.data.model.food.WeekFoodResponse
import com.myongsik.myongsikandroid.data.model.review.RequestReviewData
import com.myongsik.myongsikandroid.data.model.review.ResponseReviewData
import com.myongsik.myongsikandroid.data.repository.food.FoodRepository
import com.myongsik.myongsikandroid.BaseViewModel
import com.myongsik.myongsikandroid.util.Constant
import com.myongsik.myongsikandroid.util.MyongsikApplication
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down Expand Up @@ -116,8 +119,8 @@ class HomeViewModel @Inject constructor(

fun getMapRankRestaurant() = launch {
when (MyongsikApplication.prefs.getUserCampus()) {
Constant.S -> start("${Constant.SCRAP_COUNT},${Constant.DESC}", Constant.SEOUL, Int.MAX_VALUE)
Constant.Y -> start("${Constant.SCRAP_COUNT},${Constant.DESC}", Constant.YONGIN, Int.MAX_VALUE)
Constant.S -> start("${Constant.SCRAP_COUNT},${Constant.ASC}", Constant.SEOUL, Int.MAX_VALUE)
Constant.Y -> start("${Constant.SCRAP_COUNT},${Constant.ASC}", Constant.YONGIN, Int.MAX_VALUE)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.myongsik.myongsikandroid.data.model.user.RequestUserData
import com.myongsik.myongsikandroid.data.model.user.ResponseUserData
import com.myongsik.myongsikandroid.data.model.user.toRequestUserEntity
import com.myongsik.myongsikandroid.data.model.user.toResponseUserData
import com.myongsik.myongsikandroid.domain.model.RequestUserEntity
import com.myongsik.myongsikandroid.domain.user.PostUserDataUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import com.myongsik.myongsikandroid.BaseViewModel
import com.myongsik.myongsikandroid.data.model.food.RequestScrap
import com.myongsik.myongsikandroid.data.model.food.ResponseScrap
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.myongsikandroid.data.repository.food.FoodRepository
import com.myongsik.myongsikandroid.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import com.myongsik.myongsikandroid.BaseViewModel
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.myongsikandroid.data.model.kakao.SearchResponse
import com.myongsik.myongsikandroid.data.repository.search.SearchFoodRepository
import com.myongsik.myongsikandroid.BaseViewModel
import com.myongsik.myongsikandroid.util.Constant
import com.myongsik.myongsikandroid.util.MyongsikApplication
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.myongsik.myongsikandroid.util

import android.annotation.SuppressLint
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.text.Spannable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import net.daum.mf.map.api.MapView
import javax.inject.Inject

@HiltAndroidApp
Expand Down

0 comments on commit 3557495

Please sign in to comment.