Hide tab bar during multiselect.
This commit is contained in:
parent
be241524db
commit
fa515be258
6 changed files with 35 additions and 9 deletions
|
@ -1019,6 +1019,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
|||
if (megaphoneContainer.resolved()) {
|
||||
ViewUtil.fadeOut(megaphoneContainer.get(), 250);
|
||||
}
|
||||
requireCallback().onMultiSelectStarted();
|
||||
}
|
||||
|
||||
private void endActionModeIfActive() {
|
||||
|
@ -1036,6 +1037,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
|||
if (megaphoneContainer.resolved()) {
|
||||
ViewUtil.fadeIn(megaphoneContainer.get(), 250);
|
||||
}
|
||||
requireCallback().onMultiSelectFinished();
|
||||
}
|
||||
|
||||
void updateEmptyState(boolean isConversationEmpty) {
|
||||
|
@ -1565,6 +1567,8 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
|||
void updateProxyStatus(@NonNull WebSocketConnectionState state);
|
||||
void onSearchOpened();
|
||||
void onSearchClosed();
|
||||
void onMultiSelectStarted();
|
||||
void onMultiSelectFinished();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@ import android.graphics.Typeface
|
|||
import android.os.Build
|
||||
import org.signal.imageeditor.core.Renderer
|
||||
import org.signal.imageeditor.core.RendererContext
|
||||
import org.thoughtcrime.securesms.util.FutureTaskListener
|
||||
import org.thoughtcrime.securesms.util.LocaleUtil
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.ExecutionException
|
||||
|
||||
/**
|
||||
* RenderContext TypefaceProvider that provides typefaces using TextFont.
|
||||
|
@ -20,7 +17,7 @@ class FontTypefaceProvider : RendererContext.TypefaceProvider {
|
|||
|
||||
override fun getSelectedTypeface(context: Context, renderer: Renderer, invalidate: RendererContext.Invalidate): Typeface {
|
||||
return getTypeface()
|
||||
//TODO [cody] Need to rework Fonts.kt to not hit network on main, reverting to old typeface for now
|
||||
// TODO [cody] Need to rework Fonts.kt to not hit network on main, reverting to old typeface for now
|
||||
// val typeface = cachedTypeface
|
||||
// if (typeface != null && cachedLocale == LocaleUtil.getFirstLocale()) {
|
||||
// return typeface
|
||||
|
|
|
@ -195,6 +195,14 @@ class MainActivityListHostFragment : Fragment(R.layout.main_activity_list_host_f
|
|||
conversationListTabsViewModel.onSearchClosed()
|
||||
}
|
||||
|
||||
override fun onMultiSelectStarted() {
|
||||
conversationListTabsViewModel.onMultiSelectStarted()
|
||||
}
|
||||
|
||||
override fun onMultiSelectFinished() {
|
||||
conversationListTabsViewModel.onMultiSelectFinished()
|
||||
}
|
||||
|
||||
private fun initializeProfileIcon(recipient: Recipient) {
|
||||
Log.d(TAG, "Initializing profile icon")
|
||||
val icon = requireView().findViewById<ImageView>(R.id.toolbar_icon)
|
||||
|
|
|
@ -86,7 +86,7 @@ class ConversationListTabsFragment : Fragment(R.layout.conversation_list_tabs) {
|
|||
storiesUnreadIndicator.visible = state.unreadStoriesCount > 0
|
||||
storiesUnreadIndicator.text = formatCount(state.unreadStoriesCount)
|
||||
|
||||
requireView().visible = !state.isSearchOpen
|
||||
requireView().visible = state.visibilityState.isVisible()
|
||||
}
|
||||
|
||||
private fun runLottieAnimations(vararg toAnimate: LottieAnimationView) {
|
||||
|
|
|
@ -4,5 +4,14 @@ data class ConversationListTabsState(
|
|||
val tab: ConversationListTab = ConversationListTab.CHATS,
|
||||
val unreadChatsCount: Long = 0L,
|
||||
val unreadStoriesCount: Long = 0L,
|
||||
val isSearchOpen: Boolean = false
|
||||
)
|
||||
val visibilityState: VisibilityState = VisibilityState()
|
||||
) {
|
||||
data class VisibilityState(
|
||||
val isSearchOpen: Boolean = false,
|
||||
val isMultiSelectOpen: Boolean = false
|
||||
) {
|
||||
fun isVisible(): Boolean {
|
||||
return !isSearchOpen && !isMultiSelectOpen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,19 @@ class ConversationListTabsViewModel(repository: ConversationListTabRepository) :
|
|||
}
|
||||
|
||||
fun onSearchOpened() {
|
||||
store.update { it.copy(isSearchOpen = true) }
|
||||
store.update { it.copy(visibilityState = it.visibilityState.copy(isSearchOpen = true)) }
|
||||
}
|
||||
|
||||
fun onSearchClosed() {
|
||||
store.update { it.copy(isSearchOpen = false) }
|
||||
store.update { it.copy(visibilityState = it.visibilityState.copy(isSearchOpen = false)) }
|
||||
}
|
||||
|
||||
fun onMultiSelectStarted() {
|
||||
store.update { it.copy(visibilityState = it.visibilityState.copy(isMultiSelectOpen = true)) }
|
||||
}
|
||||
|
||||
fun onMultiSelectFinished() {
|
||||
store.update { it.copy(visibilityState = it.visibilityState.copy(isMultiSelectOpen = false)) }
|
||||
}
|
||||
|
||||
class Factory(private val repository: ConversationListTabRepository) : ViewModelProvider.Factory {
|
||||
|
|
Loading…
Add table
Reference in a new issue