From f21f96f8a39d64fadea78040f4a50558a6e1db86 Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Fri, 9 Jan 2026 17:56:28 +0900 Subject: [PATCH] . --- app/src/main/AndroidManifest.xml | 2 +- .../launcher/apps/AppDrawerBottomSheet.kt | 29 +++-- .../lunatic/launcher/workers/WorkersDb.kt | 2 +- app/src/main/res/drawable/bg_grid_item.xml | 29 +++++ .../res/layout/bottom_sheet_app_drawer.xml | 111 ++++++------------ 5 files changed, 89 insertions(+), 84 deletions(-) create mode 100644 app/src/main/res/drawable/bg_grid_item.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index adeef5f6..b11917dd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -290,7 +290,7 @@ - + diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawerBottomSheet.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawerBottomSheet.kt index 39fc3a5f..ef4be267 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawerBottomSheet.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawerBottomSheet.kt @@ -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(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()) // 빈 리스트로 갱신하여 잔상 제거 } diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt index fd930ed1..6ded9c6d 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt @@ -142,7 +142,7 @@ object WorkersDb { } // [핵심] 현재 시간 상황에 맞는 추천 리스트 가져오기 - fun getContextualRecommendations(limit: Int = 8): List { + fun getContextualRecommendations(limit: Int = 10): List { val realm = getRealm() val calendar = Calendar.getInstance() diff --git a/app/src/main/res/drawable/bg_grid_item.xml b/app/src/main/res/drawable/bg_grid_item.xml new file mode 100644 index 00000000..d8ee950d --- /dev/null +++ b/app/src/main/res/drawable/bg_grid_item.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/bottom_sheet_app_drawer.xml b/app/src/main/res/layout/bottom_sheet_app_drawer.xml index b0a159c3..1f6aed5c 100644 --- a/app/src/main/res/layout/bottom_sheet_app_drawer.xml +++ b/app/src/main/res/layout/bottom_sheet_app_drawer.xml @@ -85,106 +85,67 @@ android:text="0 Apps" app:layout_constraintTop_toTopOf="parent" app:layout_constraintRight_toRightOf="parent"/> - + + app:layout_constraintTop_toTopOf="parent"/> + - + app:layout_constraintTop_toBottomOf="@id/recAppsList"/> - - - - - - - - - + app:layout_constraintTop_toBottomOf="@id/appsList"/> + + + + + + \ No newline at end of file