mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-158 Editor | Fix | Incorrect selected state for highlight and callout blocks when nested (#2650)
This commit is contained in:
parent
c8913b2861
commit
37d21a9ea5
3 changed files with 11 additions and 16 deletions
|
@ -1,7 +1,6 @@
|
|||
package com.anytypeio.anytype.core_ui.features.editor.holders.text
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.Editable
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -17,15 +16,13 @@ import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
|||
import com.anytypeio.anytype.core_ui.features.editor.SupportNesting
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.DecoratableViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
import com.anytypeio.anytype.core_ui.features.editor.marks
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.applySelectorOffset
|
||||
import com.anytypeio.anytype.core_ui.tools.DefaultSpannableFactory
|
||||
import com.anytypeio.anytype.core_ui.widgets.ObjectIconWidget
|
||||
import com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.mention.MentionEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
|
||||
class Callout(
|
||||
val binding: ItemBlockCalloutBinding,
|
||||
|
@ -107,10 +104,10 @@ class Callout(
|
|||
}
|
||||
}
|
||||
|
||||
override fun setBackgroundColor(color: ThemeColor) {
|
||||
override fun setBackgroundColor(background: ThemeColor) {
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
binding.calloutCardContainer.setBlockBackgroundTintColor(
|
||||
color = color,
|
||||
color = background,
|
||||
default = itemView.resources.veryLight(
|
||||
color = ThemeColor.GREY
|
||||
)
|
||||
|
@ -148,6 +145,10 @@ class Callout(
|
|||
color = last.background,
|
||||
default = itemView.resources.getColor(R.color.palette_very_light_grey, null)
|
||||
)
|
||||
binding.selectionView.applySelectorOffset<FrameLayout.LayoutParams>(
|
||||
content = binding.calloutCardContainer,
|
||||
res = itemView.resources
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.anytypeio.anytype.core_ui.features.editor.holders.text
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.Editable
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -15,14 +14,11 @@ import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
|||
import com.anytypeio.anytype.core_ui.features.editor.SupportNesting
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.DecoratableViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
import com.anytypeio.anytype.core_ui.features.editor.marks
|
||||
import com.anytypeio.anytype.core_ui.tools.DefaultSpannableFactory
|
||||
import com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.mention.MentionEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
|
||||
class Highlight(
|
||||
val binding: ItemBlockHighlightBinding,
|
||||
|
@ -94,10 +90,8 @@ class Highlight(
|
|||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
if (BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
decoratableContainer.decorate(decorations) { rect ->
|
||||
indent.updateLayoutParams {
|
||||
width = dimen(R.dimen.default_indent) + rect.left
|
||||
}
|
||||
binding.highlightBlockContentContainer.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.default_indent) + rect.left
|
||||
marginEnd = dimen(R.dimen.dp_8) + rect.right
|
||||
bottomMargin = rect.bottom
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/highlightBlockContentContainer"
|
||||
|
@ -28,9 +28,9 @@
|
|||
|
||||
<FrameLayout
|
||||
android:id="@+id/highlightGlyphContainer"
|
||||
android:layout_marginTop="@dimen/default_highlight_content_margin_top"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/default_highlight_content_margin_top">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue