.
This commit is contained in:
@@ -10,6 +10,8 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
@@ -92,13 +94,30 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
|
||||
setupAdapters()
|
||||
setupSearchButtons()
|
||||
setupListeners()
|
||||
|
||||
setupKeyboardObserver()
|
||||
// 초기 데이터 로드
|
||||
fetchApps()
|
||||
}
|
||||
|
||||
private fun setupKeyboardObserver() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
|
||||
// 키보드(IME)가 보이는지 확인
|
||||
val isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime())
|
||||
|
||||
if (isKeyboardVisible) {
|
||||
binding.quickSearch.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.quickSearch.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 키보드 높이만큼 패딩 처리 등을 자동으로 하게 둠
|
||||
insets
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
val dialog = dialog as? com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
dialog?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)?.let { bottomSheet ->
|
||||
|
||||
@@ -126,11 +145,11 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
|
||||
binding.appsList.setItemViewCacheSize(20)
|
||||
binding.appsList.setHasFixedSize(true) //
|
||||
|
||||
binding.contactList.layoutManager = GridLayoutManager(context, 3,GridLayoutManager.HORIZONTAL,false)
|
||||
binding.contactList.layoutManager = GridLayoutManager(context, 2,GridLayoutManager.HORIZONTAL,false)
|
||||
binding.contactList.adapter = contactAdapter
|
||||
|
||||
recAdapter = RecommendedAppsAdapter(requireContext(),pm,childFragmentManager)
|
||||
binding.recAppsList.layoutManager = GridLayoutManager(context, 1,GridLayoutManager.HORIZONTAL,false)
|
||||
binding.recAppsList.layoutManager = GridLayoutManager(context, 2,GridLayoutManager.HORIZONTAL,false)
|
||||
binding.recAppsList.adapter = recAdapter
|
||||
}
|
||||
|
||||
@@ -304,7 +323,6 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
|
||||
withContext(Dispatchers.Main) {
|
||||
|
||||
if (unifiedList.isNotEmpty()) {
|
||||
binding.titleRecommend.visibility = View.VISIBLE
|
||||
binding.recAppsList.visibility = View.VISIBLE
|
||||
recAdapter?.submitList(unifiedList)
|
||||
}
|
||||
@@ -316,12 +334,9 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
|
||||
binding.appsCount.text = "${packageList.size} Apps"
|
||||
|
||||
if (contactsList.isNotEmpty()) {
|
||||
binding.titleContact.visibility = View.VISIBLE
|
||||
binding.contactList.visibility = View.VISIBLE
|
||||
contactAdapter?.updateData(contactsList)
|
||||
} else {
|
||||
// 검색 결과가 없으면 숨김
|
||||
binding.titleContact.visibility = View.GONE
|
||||
binding.contactList.visibility = View.GONE
|
||||
contactAdapter?.updateData(emptyList()) // 빈 리스트로 갱신하여 잔상 제거
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ object WorkersDb {
|
||||
}
|
||||
|
||||
// [핵심] 현재 시간 상황에 맞는 추천 리스트 가져오기
|
||||
fun getContextualRecommendations(limit: Int = 8): List<ScoredItem> {
|
||||
fun getContextualRecommendations(limit: Int = 10): List<ScoredItem> {
|
||||
val realm = getRealm()
|
||||
val calendar = Calendar.getInstance()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user