feat(chat): 대화 탭 DM 시작 진입점을 추가한다
This commit is contained in:
@@ -12,6 +12,9 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.recipient.DmRecipientPickerActivity
|
||||
import kr.co.vividnext.sodalive.databinding.FragmentV2MainChatBinding
|
||||
import kr.co.vividnext.sodalive.mypage.can.charge.CanChargeActivity
|
||||
import kr.co.vividnext.sodalive.search.SearchActivity
|
||||
@@ -51,12 +54,19 @@ class ChatMainFragment : BaseFragment<FragmentV2MainChatBinding>(
|
||||
private var isChatPullRefreshing = false
|
||||
private var refreshingChatFilter: ChatRoomFilter? = null
|
||||
private var lastRenderedChatContentState: ChatRoomListUiState.Content? = null
|
||||
private var shouldRefreshChatRoomsOnResume = false
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
shouldRefreshChatRoomsOnResume = false
|
||||
loadingDialog = LoadingDialog(requireActivity(), layoutInflater)
|
||||
|
||||
setupTitleBar()
|
||||
val isCreator = SharedPreferenceManager.role == MemberRole.CREATOR.name
|
||||
binding.btnNewDm.isVisible = isCreator
|
||||
binding.btnNewDm.setOnClickListener {
|
||||
if (isCreator) openWithLoginGuard(DmRecipientPickerActivity::class.java)
|
||||
}
|
||||
val initialFilter = getInitialFilter() ?: ChatRoomFilter.ALL
|
||||
selectedFilter = initialFilter
|
||||
setupFilterTabs(initialFilter)
|
||||
@@ -67,6 +77,17 @@ class ChatMainFragment : BaseFragment<FragmentV2MainChatBinding>(
|
||||
viewModel.loadFirstPage(initialFilter)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (!shouldRefreshChatRoomsOnResume) {
|
||||
shouldRefreshChatRoomsOnResume = true
|
||||
return
|
||||
}
|
||||
cancelChatPullRefresh()
|
||||
bindChatRooms(emptyList(), showEmpty = false)
|
||||
viewModel.loadFirstPage(selectedFilter)
|
||||
}
|
||||
|
||||
fun selectFilter(filter: ChatRoomFilter) {
|
||||
if (refreshingChatFilter != null && refreshingChatFilter != filter) {
|
||||
cancelChatPullRefresh()
|
||||
|
||||
@@ -58,4 +58,17 @@
|
||||
tools:text="아직 나눈 대화가 없어요.\n크리에이터와 이야기를 시작해 보세요." />
|
||||
</FrameLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
<ImageButton
|
||||
android:id="@+id/btn_new_dm"
|
||||
android:layout_width="66dp"
|
||||
android:layout_height="66dp"
|
||||
android:layout_margin="@dimen/spacing_14"
|
||||
android:background="@drawable/bg_creator_channel_owner_fab"
|
||||
android:contentDescription="@string/screen_chat_floating_button"
|
||||
android:elevation="8dp"
|
||||
android:padding="@dimen/spacing_14"
|
||||
android:src="@drawable/ic_plus_no_bg"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user