mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-302 Relations | Enhancement | Update relation value before reloading object by source relation (#2545)
This commit is contained in:
parent
552298b342
commit
4152f01888
1 changed files with 24 additions and 4 deletions
|
@ -4,7 +4,9 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
@ -72,10 +74,28 @@ open class RelationTextValueFragment :
|
|||
|
||||
private val relationValueActionAdapter by lazy {
|
||||
RelationActionAdapter { action ->
|
||||
vm.onAction(
|
||||
target = objectId,
|
||||
action = action
|
||||
)
|
||||
val input = binding.recycler.findViewById<TextView?>(R.id.textInputField)
|
||||
val parsed = input?.text?.toString().orEmpty()
|
||||
// Workaround for updating relation value when before reloading content
|
||||
if (action is RelationValueAction.Url.Reload && parsed != action.url) {
|
||||
withParent<TextValueEditReceiver> {
|
||||
onTextValueChanged(
|
||||
ctx = ctx,
|
||||
relationId = relationId,
|
||||
objectId = objectId,
|
||||
text = parsed
|
||||
)
|
||||
}
|
||||
vm.onAction(
|
||||
target = objectId,
|
||||
action = action.copy(url = parsed)
|
||||
)
|
||||
} else {
|
||||
vm.onAction(
|
||||
target = objectId,
|
||||
action = action
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue