This commit is contained in:
lunaticbum 2026-01-09 17:56:28 +09:00
parent 98fd382ed4
commit f21f96f8a3
5 changed files with 89 additions and 84 deletions

View File

@ -290,7 +290,7 @@
</intent-filter> </intent-filter>
</service> </service>
<!-- <service android:name="bums.lunatic.launcher.workers.LocationUpdateService" />--> <service android:name="bums.lunatic.launcher.workers.LocationUpdateService" />
<!-- <receiver android:name=".LauncherActivity$EndCallReceiver"--> <!-- <receiver android:name=".LauncherActivity$EndCallReceiver"-->
<!-- android:enabled="true"--> <!-- android:enabled="true"-->

View File

@ -10,6 +10,8 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.widget.doOnTextChanged import androidx.core.widget.doOnTextChanged
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
@ -92,13 +94,30 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
setupAdapters() setupAdapters()
setupSearchButtons() setupSearchButtons()
setupListeners() setupListeners()
setupKeyboardObserver()
// 초기 데이터 로드 // 초기 데이터 로드
fetchApps() 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() { override fun onStart() {
super.onStart() super.onStart()
val dialog = dialog as? com.google.android.material.bottomsheet.BottomSheetDialog val dialog = dialog as? com.google.android.material.bottomsheet.BottomSheetDialog
dialog?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)?.let { bottomSheet -> 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.setItemViewCacheSize(20)
binding.appsList.setHasFixedSize(true) // 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 binding.contactList.adapter = contactAdapter
recAdapter = RecommendedAppsAdapter(requireContext(),pm,childFragmentManager) 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 binding.recAppsList.adapter = recAdapter
} }
@ -304,7 +323,6 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
if (unifiedList.isNotEmpty()) { if (unifiedList.isNotEmpty()) {
binding.titleRecommend.visibility = View.VISIBLE
binding.recAppsList.visibility = View.VISIBLE binding.recAppsList.visibility = View.VISIBLE
recAdapter?.submitList(unifiedList) recAdapter?.submitList(unifiedList)
} }
@ -316,12 +334,9 @@ class AppDrawerBottomSheet : BottomSheetDialogFragment() {
binding.appsCount.text = "${packageList.size} Apps" binding.appsCount.text = "${packageList.size} Apps"
if (contactsList.isNotEmpty()) { if (contactsList.isNotEmpty()) {
binding.titleContact.visibility = View.VISIBLE
binding.contactList.visibility = View.VISIBLE binding.contactList.visibility = View.VISIBLE
contactAdapter?.updateData(contactsList) contactAdapter?.updateData(contactsList)
} else { } else {
// 검색 결과가 없으면 숨김
binding.titleContact.visibility = View.GONE
binding.contactList.visibility = View.GONE binding.contactList.visibility = View.GONE
contactAdapter?.updateData(emptyList()) // 빈 리스트로 갱신하여 잔상 제거 contactAdapter?.updateData(emptyList()) // 빈 리스트로 갱신하여 잔상 제거
} }

View File

@ -142,7 +142,7 @@ object WorkersDb {
} }
// [핵심] 현재 시간 상황에 맞는 추천 리스트 가져오기 // [핵심] 현재 시간 상황에 맞는 추천 리스트 가져오기
fun getContextualRecommendations(limit: Int = 8): List<ScoredItem> { fun getContextualRecommendations(limit: Int = 10): List<ScoredItem> {
val realm = getRealm() val realm = getRealm()
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#4DFFFFFF"> <item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners
android:topLeftRadius="8dp"
android:topRightRadius="32dp"
android:bottomLeftRadius="32dp"
android:bottomRightRadius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="#26FFFFFF" />
<stroke
android:width="1dp"
android:color="#1AFFFFFF" />
<corners
android:topLeftRadius="8dp"
android:topRightRadius="32dp"
android:bottomLeftRadius="32dp"
android:bottomRightRadius="8dp" />
</shape>
</item>
</ripple>

View File

@ -85,106 +85,67 @@
android:text="0 Apps" android:text="0 Apps"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"/> app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:id="@+id/title_recommend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="앱 목록"
android:textColor="@color/white"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recAppsList" android:id="@+id/recAppsList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="50dp" android:background="@drawable/bg_grid_item"
android:background="@android:color/transparent"
android:overScrollMode="never" android:overScrollMode="never"
android:layout_margin="10dp"
android:padding="16dp"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
app:layout_constraintTop_toBottomOf="@id/title_recommend"/> app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/title_apps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="앱 목록"
android:textColor="@color/white"
app:layout_constraintTop_toBottomOf="@+id/recAppsList"
app:layout_constraintLeft_toLeftOf="parent"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/appsList" android:id="@+id/appsList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="100dp" android:layout_margin="10dp"
android:background="@android:color/transparent" android:padding="16dp"
android:background="@drawable/bg_grid_item"
android:overScrollMode="never" android:overScrollMode="never"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
app:layout_constraintTop_toBottomOf="@id/title_apps"/> app:layout_constraintTop_toBottomOf="@id/recAppsList"/>
<TextView
android:id="@+id/title_webs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="빠른 검색"
android:textColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/appsList"
app:layout_constraintLeft_toLeftOf="parent"/>
<LinearLayout
android:id="@+id/quickSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center_vertical"
app:layout_constraintTop_toBottomOf="@id/title_webs">
<bums.lunatic.launcher.view.CircleImageView
android:id="@+id/search_nmap"
style="@style/SearchIcons"
android:src="@drawable/navermap"/>
<bums.lunatic.launcher.view.CircleImageView
android:id="@+id/search_naver"
style="@style/SearchIcons"
android:src="@drawable/naver"/>
<bums.lunatic.launcher.view.CircleImageView
android:id="@+id/search_youtube"
style="@style/SearchIcons"
android:src="@drawable/youtube"/>
</LinearLayout>
<TextView
android:id="@+id/title_contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:textColor="@color/white"
android:text="연락처"
app:layout_constraintTop_toBottomOf="@id/quickSearch"
app:layout_constraintLeft_toLeftOf="parent"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/contactList" android:id="@+id/contactList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="90dp" android:background="@drawable/bg_grid_item"
android:layout_margin="10dp"
android:padding="16dp"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
app:layout_constraintTop_toBottomOf="@id/title_contact"/> app:layout_constraintTop_toBottomOf="@id/appsList"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/quickSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_grid_item"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent">
<bums.lunatic.launcher.view.CircleImageView
android:id="@+id/search_nmap"
style="@style/SearchIcons"
android:src="@drawable/navermap"/>
<bums.lunatic.launcher.view.CircleImageView
android:id="@+id/search_naver"
style="@style/SearchIcons"
android:src="@drawable/naver"/>
<bums.lunatic.launcher.view.CircleImageView
android:id="@+id/search_youtube"
style="@style/SearchIcons"
android:src="@drawable/youtube"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>