mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 13:57:10 +09:00
DROID-738 App | Fix | Fix broken click listener job subscription (#2794)
This commit is contained in:
parent
9111db8855
commit
39faff3e2a
3 changed files with 25 additions and 25 deletions
|
@ -346,6 +346,17 @@ class DashboardFragment :
|
|||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
click(binding.btnAddDoc) { vm.onAddNewDocumentClicked() }
|
||||
click(binding.btnSearch) { vm.onPageSearchClicked() }
|
||||
click(binding.btnMarketplace) { toast(getString(R.string.coming_soon)) }
|
||||
click(binding.ivSettings) { vm.onSettingsClicked() }
|
||||
click(binding.avatarContainer) { vm.onAvatarClicked() }
|
||||
click(binding.tvCancel) { vm.onCancelSelectionClicked() }
|
||||
click(binding.tvSelectAll) { vm.onSelectAllClicked() }
|
||||
click(binding.tvRestore) { vm.onPutBackClicked() }
|
||||
click(binding.tvDelete) { vm.onDeleteObjectsClicked() }
|
||||
|
||||
vm.onStart()
|
||||
}
|
||||
|
||||
|
@ -408,11 +419,9 @@ class DashboardFragment :
|
|||
}
|
||||
|
||||
private fun setup() {
|
||||
|
||||
binding.tabsLayout.apply {
|
||||
tabMode = TabLayout.MODE_SCROLLABLE
|
||||
}
|
||||
|
||||
binding.dashboardPager.apply {
|
||||
adapter = dashboardPagerAdapter
|
||||
TabLayoutMediator(binding.tabsLayout, binding.dashboardPager) { tab, position ->
|
||||
|
@ -425,16 +434,6 @@ class DashboardFragment :
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
click(binding.btnAddDoc) { vm.onAddNewDocumentClicked() }
|
||||
click(binding.btnSearch) { vm.onPageSearchClicked() }
|
||||
click(binding.btnMarketplace) { toast(getString(R.string.coming_soon)) }
|
||||
click(binding.ivSettings) { vm.onSettingsClicked() }
|
||||
click(binding.avatarContainer) { vm.onAvatarClicked() }
|
||||
click(binding.tvCancel) { vm.onCancelSelectionClicked() }
|
||||
click(binding.tvSelectAll) { vm.onSelectAllClicked() }
|
||||
click(binding.tvRestore) { vm.onPutBackClicked() }
|
||||
click(binding.tvDelete) { vm.onDeleteObjectsClicked() }
|
||||
}
|
||||
|
||||
override fun inflateBinding(
|
||||
|
|
|
@ -52,14 +52,6 @@ abstract class ObjectMenuBaseFragment :
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
click(binding.objectDiagnostics) { vm.onDiagnosticsClicked(ctx) }
|
||||
click(binding.optionHistory) { vm.onHistoryClicked() }
|
||||
click(binding.optionLayout) { vm.onLayoutClicked(ctx) }
|
||||
click(binding.optionIcon) { vm.onIconClicked(ctx) }
|
||||
click(binding.optionRelations) { vm.onRelationsClicked() }
|
||||
click(binding.optionCover) { vm.onCoverClicked(ctx) }
|
||||
|
||||
binding.rvActions.apply {
|
||||
layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
adapter = actionAdapter
|
||||
|
@ -73,6 +65,13 @@ abstract class ObjectMenuBaseFragment :
|
|||
}
|
||||
|
||||
override fun onStart() {
|
||||
click(binding.objectDiagnostics) { vm.onDiagnosticsClicked(ctx) }
|
||||
click(binding.optionHistory) { vm.onHistoryClicked() }
|
||||
click(binding.optionLayout) { vm.onLayoutClicked(ctx) }
|
||||
click(binding.optionIcon) { vm.onIconClicked(ctx) }
|
||||
click(binding.optionRelations) { vm.onRelationsClicked() }
|
||||
click(binding.optionCover) { vm.onCoverClicked(ctx) }
|
||||
|
||||
proceed(vm.actions) { actionAdapter.submitList(it) }
|
||||
proceed(vm.toasts) { toast(it) }
|
||||
proceed(vm.isDismissed) { isDismissed -> if (isDismissed) dismiss() }
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
package com.anytypeio.anytype.core_ui.reactive
|
||||
|
||||
import android.os.Looper
|
||||
import android.os.Parcelable
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.core_utils.ext.throttleFirst
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseFragment
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.callbackFlow
|
||||
|
@ -109,6 +104,9 @@ fun checkMainThread() = check(Looper.myLooper() == Looper.getMainLooper()) {
|
|||
"Expected to be called on the main thread but was " + Thread.currentThread().name
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called from [BaseFragment.onStart]
|
||||
*/
|
||||
fun BaseFragment<*>.click(
|
||||
view: View,
|
||||
action: () -> Unit
|
||||
|
@ -119,6 +117,10 @@ fun BaseFragment<*>.click(
|
|||
.launchIn(lifecycleScope)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Should be called from [BaseBottomSheetFragment.onStart]
|
||||
*/
|
||||
fun BaseBottomSheetFragment<*>.click(
|
||||
view: View,
|
||||
action: () -> Unit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue