mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
* #594: add widget + adapter + holders * #594: update background state with enable/disable * #594: add state disabled to icons * #594: fixes * #594: style toolbar, add tab layout * #594: fix * #594: sample * #594: pr fix * #594: pr fix
This commit is contained in:
parent
2b29ad7e0e
commit
1ea9ab8dcd
31 changed files with 744 additions and 25 deletions
|
@ -0,0 +1,75 @@
|
|||
package com.agileburo.anytype.core_ui.widgets.toolbar.style
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.agileburo.anytype.core_ui.R
|
||||
import com.agileburo.anytype.core_ui.common.Alignment
|
||||
import com.agileburo.anytype.core_ui.common.Markup
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingEvent
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingType
|
||||
import com.agileburo.anytype.core_ui.model.StyleConfig
|
||||
import com.agileburo.anytype.core_ui.state.ControlPanelState
|
||||
|
||||
class StyleAdapter(
|
||||
var props: ControlPanelState.Toolbar.Styling.Props?,
|
||||
private val visibleTypes: ArrayList<StylingType>,
|
||||
private val enabledMarkup: ArrayList<Markup.Type>,
|
||||
private val enabledAlignment: ArrayList<Alignment>,
|
||||
private val onStylingEvent: (StylingEvent) -> Unit
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
fun updateConfig(config: StyleConfig, props: ControlPanelState.Toolbar.Styling.Props?) {
|
||||
visibleTypes.clear()
|
||||
visibleTypes.addAll(config.visibleTypes)
|
||||
enabledMarkup.clear()
|
||||
enabledMarkup.addAll(config.enabledMarkup)
|
||||
enabledAlignment.clear()
|
||||
enabledAlignment.addAll(config.enabledAlignment)
|
||||
this.props = props
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
return when (viewType) {
|
||||
StylingType.STYLE.ordinal -> StyleTextViewHolder(
|
||||
view = inflater.inflate(
|
||||
R.layout.block_style_toolbar_style,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
StylingType.TEXT_COLOR.ordinal -> StyleTextColorViewHolder(
|
||||
view = inflater.inflate(
|
||||
R.layout.block_style_toolbar_color,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
StylingType.BACKGROUND.ordinal -> StyleBackgroundViewHolder(
|
||||
view = inflater.inflate(
|
||||
R.layout.block_style_toolbar_background,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
else -> throw IllegalStateException("Unexpected view type: $viewType")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (holder) {
|
||||
is StyleTextViewHolder -> {
|
||||
holder.bind(onStylingEvent, enabledMarkup, enabledAlignment, props)
|
||||
}
|
||||
is StyleTextColorViewHolder -> {
|
||||
holder.bind(onStylingEvent, props?.color)
|
||||
}
|
||||
is StyleBackgroundViewHolder -> {
|
||||
holder.bind(onStylingEvent, props?.background)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = visibleTypes.size
|
||||
override fun getItemViewType(position: Int): Int = visibleTypes[position].getViewType()
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.agileburo.anytype.core_ui.widgets.toolbar.style
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.agileburo.anytype.core_ui.common.ThemeColor
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingEvent
|
||||
import kotlinx.android.synthetic.main.block_style_toolbar_background.view.*
|
||||
|
||||
class StyleBackgroundViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
private val default = itemView.backgroundColorDefault
|
||||
private val grey = itemView.backgroundColorGrey
|
||||
private val yellow = itemView.backgroundColorYellow
|
||||
private val orange = itemView.backgroundColorOrange
|
||||
private val red = itemView.backgroundColorRed
|
||||
private val pink = itemView.backgroundColorPink
|
||||
private val purple = itemView.backgroundColorPurple
|
||||
private val blue = itemView.backgroundColorBlue
|
||||
private val ice = itemView.backgroundColorIce
|
||||
private val teal = itemView.backgroundColorTeal
|
||||
private val green = itemView.backgroundColorGreen
|
||||
|
||||
fun bind(
|
||||
onStylingEvent: (StylingEvent) -> Unit,
|
||||
background: String?
|
||||
) {
|
||||
|
||||
default.isSelected = background == ThemeColor.DEFAULT.title
|
||||
grey.isSelected = background == ThemeColor.GREY.title
|
||||
yellow.isSelected = background == ThemeColor.YELLOW.title
|
||||
orange.isSelected = background == ThemeColor.ORANGE.title
|
||||
red.isSelected = background == ThemeColor.RED.title
|
||||
pink.isSelected = background == ThemeColor.PINK.title
|
||||
purple.isSelected = background == ThemeColor.PURPLE.title
|
||||
blue.isSelected = background == ThemeColor.BLUE.title
|
||||
ice.isSelected = background == ThemeColor.ICE.title
|
||||
teal.isSelected = background == ThemeColor.TEAL.title
|
||||
green.isSelected = background == ThemeColor.GREEN.title
|
||||
|
||||
default.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.DEFAULT))
|
||||
}
|
||||
grey.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.GREY))
|
||||
}
|
||||
yellow.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.YELLOW))
|
||||
}
|
||||
orange.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.ORANGE))
|
||||
}
|
||||
red.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.RED))
|
||||
}
|
||||
pink.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.PINK))
|
||||
}
|
||||
purple.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.PURPLE))
|
||||
}
|
||||
blue.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.BLUE))
|
||||
}
|
||||
ice.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.ICE))
|
||||
}
|
||||
teal.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.TEAL))
|
||||
}
|
||||
green.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Background(color = ThemeColor.GREEN))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.agileburo.anytype.core_ui.widgets.toolbar.style
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.agileburo.anytype.core_ui.common.ThemeColor
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingEvent
|
||||
import kotlinx.android.synthetic.main.block_style_toolbar_color.view.*
|
||||
|
||||
class StyleTextColorViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
private val default = itemView.textColorDefault
|
||||
private val grey = itemView.textColorGrey
|
||||
private val yellow = itemView.textColorYellow
|
||||
private val orange = itemView.textColorOrange
|
||||
private val red = itemView.textColorRed
|
||||
private val pink = itemView.textColorPink
|
||||
private val purple = itemView.textColorPurple
|
||||
private val blue = itemView.textColorBlue
|
||||
private val ice = itemView.textColorIce
|
||||
private val teal = itemView.textColorTeal
|
||||
private val green = itemView.textColorGreen
|
||||
|
||||
fun bind(
|
||||
onStylingEvent: (StylingEvent) -> Unit,
|
||||
color: String?
|
||||
) {
|
||||
default.isSelected = color == ThemeColor.DEFAULT.title
|
||||
grey.isSelected = color == ThemeColor.GREY.title
|
||||
yellow.isSelected = color == ThemeColor.YELLOW.title
|
||||
orange.isSelected = color == ThemeColor.ORANGE.title
|
||||
red.isSelected = color == ThemeColor.RED.title
|
||||
pink.isSelected = color == ThemeColor.PINK.title
|
||||
purple.isSelected = color == ThemeColor.PURPLE.title
|
||||
blue.isSelected = color == ThemeColor.BLUE.title
|
||||
ice.isSelected = color == ThemeColor.ICE.title
|
||||
teal.isSelected = color == ThemeColor.TEAL.title
|
||||
green.isSelected = color == ThemeColor.GREEN.title
|
||||
|
||||
default.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.DEFAULT))
|
||||
}
|
||||
grey.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.GREY))
|
||||
}
|
||||
yellow.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.YELLOW))
|
||||
}
|
||||
orange.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.ORANGE))
|
||||
}
|
||||
red.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.RED))
|
||||
}
|
||||
pink.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.PINK))
|
||||
}
|
||||
purple.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.PURPLE))
|
||||
}
|
||||
blue.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.BLUE))
|
||||
}
|
||||
ice.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.ICE))
|
||||
}
|
||||
teal.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.TEAL))
|
||||
}
|
||||
green.setOnClickListener {
|
||||
onStylingEvent(StylingEvent.Coloring.Text(color = ThemeColor.GREEN))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package com.agileburo.anytype.core_ui.widgets.toolbar.style
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.agileburo.anytype.core_ui.common.Alignment
|
||||
import com.agileburo.anytype.core_ui.common.Markup
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingEvent
|
||||
import com.agileburo.anytype.core_ui.state.ControlPanelState
|
||||
import kotlinx.android.synthetic.main.block_style_toolbar_style.view.*
|
||||
|
||||
class StyleTextViewHolder(view: View): RecyclerView.ViewHolder(view) {
|
||||
|
||||
private val bold = itemView.bold
|
||||
private val iconBold = itemView.boldIcon
|
||||
private val italic = itemView.italic
|
||||
private val iconItalic = itemView.italicIcon
|
||||
private val strike = itemView.strikethrough
|
||||
private val iconStrike = itemView.strikethroughIcon
|
||||
private val code = itemView.code
|
||||
private val iconCode = itemView.codeIcon
|
||||
private val link = itemView.setUrlButton
|
||||
private val iconLink = itemView.setUrlIcon
|
||||
private val start = itemView.alignmentLeft
|
||||
private val iconStart = itemView.alignmentLeftIcon
|
||||
private val center = itemView.alignmentMiddle
|
||||
private val iconCenter = itemView.alignmentMiddleIcon
|
||||
private val end = itemView.alignmentRight
|
||||
private val iconEnd = itemView.alignmentRightIcon
|
||||
|
||||
fun bind(
|
||||
onStylingEvent: (StylingEvent) -> Unit,
|
||||
enabledMarkup: List<Markup.Type>,
|
||||
enabledAlignment: List<Alignment>,
|
||||
target: ControlPanelState.Toolbar.Styling.Props?
|
||||
) {
|
||||
with(start) {
|
||||
enabledAlignment.contains(Alignment.START).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconStart.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.alignment == Alignment.START
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Alignment.Left)
|
||||
}
|
||||
}
|
||||
with(center) {
|
||||
enabledAlignment.contains(Alignment.CENTER).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconCenter.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.alignment == Alignment.CENTER
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Alignment.Center)
|
||||
}
|
||||
}
|
||||
with(end) {
|
||||
enabledAlignment.contains(Alignment.END).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconEnd.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.alignment == Alignment.END
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Alignment.Right)
|
||||
}
|
||||
}
|
||||
with(code) {
|
||||
enabledMarkup.contains(Markup.Type.KEYBOARD).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconCode.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.isCode ?: false
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Markup.Code)
|
||||
}
|
||||
}
|
||||
with(bold) {
|
||||
enabledMarkup.contains(Markup.Type.BOLD).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconBold.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.isBold ?: false
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Markup.Bold)
|
||||
}
|
||||
}
|
||||
with(italic) {
|
||||
enabledMarkup.contains(Markup.Type.ITALIC).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconItalic.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.isItalic ?: false
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Markup.Italic)
|
||||
}
|
||||
}
|
||||
with(strike) {
|
||||
enabledMarkup.contains(Markup.Type.STRIKETHROUGH).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconStrike.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.isStrikethrough ?: false
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Markup.StrikeThrough)
|
||||
}
|
||||
}
|
||||
with(link) {
|
||||
enabledMarkup.contains(Markup.Type.LINK).let { isEnabled ->
|
||||
this.isEnabled = isEnabled
|
||||
iconLink.isEnabled = isEnabled
|
||||
if (isEnabled) {
|
||||
isSelected = target?.isLinked ?: false
|
||||
}
|
||||
}
|
||||
setOnClickListener {
|
||||
if (it.isEnabled) onStylingEvent(StylingEvent.Markup.Link)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.agileburo.anytype.core_ui.widgets.toolbar.style
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.agileburo.anytype.core_ui.R
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingEvent
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingMode
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingType
|
||||
import com.agileburo.anytype.core_ui.model.StyleConfig
|
||||
import com.agileburo.anytype.core_ui.state.ControlPanelState
|
||||
import com.agileburo.anytype.core_ui.widgets.toolbar.BlockStyleToolbarWidget
|
||||
import com.agileburo.anytype.core_utils.ext.dimen
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import kotlinx.android.synthetic.main.widget_block_style_toolbar_new.view.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.flow.consumeAsFlow
|
||||
import timber.log.Timber
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class StyleToolbarWidget @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private val channel = Channel<StylingEvent>()
|
||||
|
||||
private val blockStyleAdapter = StyleAdapter(
|
||||
props = null,
|
||||
visibleTypes = arrayListOf(),
|
||||
enabledAlignment = arrayListOf(),
|
||||
enabledMarkup = arrayListOf()
|
||||
) { event ->
|
||||
Timber.d("Styling Event : $event")
|
||||
channel.offer(event)
|
||||
}
|
||||
|
||||
val events = channel.consumeAsFlow()
|
||||
|
||||
var mode: StylingMode by Delegates.observable(StylingMode.BLOCK) { _, _, _ -> }
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.widget_block_style_toolbar_new, this)
|
||||
setup()
|
||||
}
|
||||
|
||||
private fun setup() {
|
||||
pager.adapter = blockStyleAdapter
|
||||
TabLayoutMediator(tabLayout, pager) { tab, position ->
|
||||
val viewType = blockStyleAdapter.getItemViewType(position)
|
||||
val customView = LayoutInflater.from(context).inflate(R.layout.tab_item_style_toolbar, null)
|
||||
(customView.rootView as TextView).text = getTabTitle(viewType)
|
||||
tab.customView = customView
|
||||
}.attach()
|
||||
}
|
||||
|
||||
fun update(config: StyleConfig, props: ControlPanelState.Toolbar.Styling.Props?) {
|
||||
blockStyleAdapter.updateConfig(config, props)
|
||||
blockStyleAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun showWithAnimation() {
|
||||
ObjectAnimator.ofFloat(this, BlockStyleToolbarWidget.ANIMATED_PROPERTY, 0f).apply {
|
||||
duration = BlockStyleToolbarWidget.ANIMATION_DURATION
|
||||
interpolator = DecelerateInterpolator()
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
fun hideWithAnimation() {
|
||||
ObjectAnimator.ofFloat(
|
||||
this,
|
||||
BlockStyleToolbarWidget.ANIMATED_PROPERTY,
|
||||
context.dimen(com.agileburo.anytype.core_ui.R.dimen.dp_203)
|
||||
).apply {
|
||||
duration = BlockStyleToolbarWidget.ANIMATION_DURATION
|
||||
interpolator = AccelerateInterpolator()
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTabTitle(viewType: Int) =
|
||||
when (viewType) {
|
||||
StylingType.STYLE.ordinal -> context.getString(R.string.text)
|
||||
StylingType.TEXT_COLOR.ordinal -> context.getString(R.string.color)
|
||||
StylingType.BACKGROUND.ordinal -> context.getString(R.string.background)
|
||||
else -> throw IllegalStateException("Unexpected view type: $viewType")
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_left" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_left_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_left" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_left" android:state_selected="false" android:state_enabled="true" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_left_active" android:state_selected="true" android:state_enabled="true"/>
|
||||
</selector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_middle" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_middle_active" android:state_selected="true" />
|
||||
<item android:state_enabled="false" android:drawable="@drawable/bg_toolbar_style_block_middle"/>
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_middle" android:state_selected="false" android:state_enabled="true"/>
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_middle_active" android:state_selected="true" android:state_enabled="true"/>
|
||||
</selector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_right" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_right_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_right" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_right" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_block_right_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_toolbar_style_set_link" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_set_link_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_set_link" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_set_link" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/bg_toolbar_style_set_link_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M11,2H13V6H11V2Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M11,18H13V22H11V18Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M18.999,8H4.999C4.4467,8 3.999,8.4477 3.999,9V15C3.999,15.5523 4.4467,16 4.999,16H18.999C19.5513,16 19.999,15.5523 19.999,15V9C19.999,8.4477 19.5513,8 18.999,8ZM4.999,6C3.3422,6 1.999,7.3432 1.999,9V15C1.999,16.6569 3.3422,18 4.999,18H18.999C20.6559,18 21.999,16.6569 21.999,15V9C21.999,7.3432 20.6559,6 18.999,6H4.999Z" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_center" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_center_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_center_disabled" android:state_enabled="false"/>
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_center" android:state_selected="false" android:state_enabled="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_center_active" android:state_selected="true" android:state_enabled="true" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M2,2H4V22H2V2Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M19,8H9C8.4477,8 8,8.4477 8,9V15C8,15.5523 8.4477,16 9,16H19C19.5523,16 20,15.5523 20,15V9C20,8.4477 19.5523,8 19,8ZM9,6C7.3432,6 6,7.3432 6,9V15C6,16.6569 7.3432,18 9,18H19C20.6569,18 22,16.6569 22,15V9C22,7.3432 20.6569,6 19,6H9Z" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_left" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_left_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_left_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_left" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_left_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M15,8H5C4.4477,8 4,8.4477 4,9V15C4,15.5523 4.4477,16 5,16H15C15.5523,16 16,15.5523 16,15V9C16,8.4477 15.5523,8 15,8ZM5,6C3.3431,6 2,7.3432 2,9V15C2,16.6569 3.3431,18 5,18H15C16.6569,18 18,16.6569 18,15V9C18,7.3432 16.6569,6 15,6H5Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M22,2H20V22H22V2Z" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_right" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_right_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_right_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_right" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_align_right_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="25">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M7.146,4.792V20.792H12.6308C15.8321,20.792 17.8917,19.3374 17.8917,16.3165V16.227C17.8917,14.1458 17.0186,12.9598 14.6904,12.4004C16.5037,11.7738 17.1082,10.4759 17.1082,9.0214V8.9319C17.1082,5.7766 14.9366,4.792 11.9592,4.792H7.146ZM12.586,19.2703H9.0489V13.2955H12.3174C14.9143,13.2955 15.9888,14.2353 15.9888,16.2046V16.2941C15.9888,18.2633 14.9143,19.2703 12.586,19.2703ZM11.9592,11.7738H9.0489V6.3137H11.9144C14.1531,6.3137 15.2053,7.0521 15.2053,8.8647V8.9542C15.2053,10.9235 14.3098,11.7738 11.9592,11.7738Z" />
|
||||
</vector>
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_bold" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_bold_active" android:state_selected="true" />
|
||||
|
||||
<item android:drawable="@drawable/ic_toolbar_style_bold_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_bold" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_bold_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="25">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M10.208,6.0852C10.5986,6.4757 10.5985,7.1089 10.208,7.4994L4.9152,12.792L10.208,18.0846C10.5985,18.4751 10.5986,19.1083 10.208,19.4988C9.8175,19.8893 9.1844,19.8894 8.7938,19.4988L2.0867,12.792L8.7938,6.0852C9.1844,5.6947 9.8175,5.6947 10.208,6.0852Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M13.9653,6.0852C13.5748,6.4757 13.5748,7.1089 13.9653,7.4994L19.2582,12.792L13.9653,18.0846C13.5748,18.4751 13.5748,19.1083 13.9653,19.4988C14.3558,19.8893 14.989,19.8894 15.3795,19.4988L22.0867,12.792L15.3795,6.0852C14.989,5.6947 14.3558,5.6947 13.9653,6.0852Z" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_code" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_code_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_code_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_code" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_code_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="25">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M13.758,9.292H11.8149L9.9258,20.792H11.8688L13.758,9.292Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M14.6022,5.7607C14.6022,6.4511 14.0425,7.0107 13.3522,7.0107C12.6618,7.0107 12.1022,6.4511 12.1022,5.7607C12.1022,5.0704 12.6618,4.5107 13.3522,4.5107C14.0425,4.5107 14.6022,5.0704 14.6022,5.7607Z" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_italic" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_italic_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_italic_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_italic" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_italic_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M11.4305,10.5693C11.8912,10.7013 12.3257,10.9487 12.6886,11.3116C13.8294,12.4524 13.8294,14.3021 12.6886,15.4429L9.9344,18.1971C8.7936,19.3379 6.9439,19.3379 5.8031,18.1971C4.6623,17.0562 4.6623,15.2066 5.8031,14.0658L7.733,12.1359C7.5058,11.2852 7.4739,10.3932 7.6372,9.5308C7.4786,9.6542 7.326,9.7888 7.1802,9.9345L4.426,12.6887C2.5247,14.5901 2.5247,17.6728 4.426,19.5742C6.3274,21.4755 9.4101,21.4755 11.3115,19.5742L14.0657,16.82C15.9671,14.9186 15.9671,11.8359 14.0657,9.9345C13.5761,9.4449 13.0082,9.0814 12.4023,8.844L12.0002,9.2461C11.6336,9.6127 11.4437,10.089 11.4305,10.5693Z"
|
||||
android:fillColor="#DFDDD0" />
|
||||
<path
|
||||
android:pathData="M12.5697,13.431C12.1089,13.299 11.6743,13.0515 11.3114,12.6886C10.1706,11.5478 10.1706,9.6981 11.3114,8.5573L14.0656,5.8031C15.2064,4.6623 17.0561,4.6623 18.1969,5.8031C19.3377,6.9439 19.3377,8.7936 18.1969,9.9344L16.2671,11.8642C16.4943,12.7149 16.5263,13.6069 16.363,14.4692C16.5215,14.3459 16.6741,14.2114 16.8198,14.0657L19.574,11.3115C21.4753,9.4101 21.4753,6.3274 19.574,4.426C17.6726,2.5247 14.5899,2.5247 12.6885,4.426L9.9343,7.1802C8.033,9.0816 8.033,12.1643 9.9343,14.0657C10.424,14.5553 10.9919,14.9189 11.5979,15.1563L12,14.7543C12.3666,14.3877 12.5565,13.9113 12.5697,13.431Z"
|
||||
android:fillColor="#DFDDD0" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_link" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_link_active" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_link_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_link" android:state_enabled="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_link_active" android:state_enabled="true" android:state_selected="true" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="25">
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M12.4414,21.292C8.1484,21.292 6.5976,18.8568 6.3054,16.0273H8.1934C8.4406,17.9987 9.2273,19.6685 12.4414,19.6685C14.5091,19.6685 16.1049,18.4161 16.1049,16.5376C16.1049,14.659 15.2733,13.8472 12.2166,13.3602C8.8452,12.8036 6.8448,11.7599 6.8448,8.7913C6.8448,6.2633 8.9801,4.292 12.0143,4.292C15.2509,4.292 17.2063,5.8923 17.5434,8.8609H15.7903C15.4082,6.7504 14.2619,5.9155 12.0143,5.9155C9.7892,5.9155 8.6654,7.0287 8.6654,8.6058C8.6654,10.206 9.2498,11.0874 12.5313,11.5744C16.1049,12.131 17.9929,13.2906 17.9929,16.3984C17.9929,19.1815 15.6329,21.292 12.4414,21.292Z" />
|
||||
<path
|
||||
android:fillColor="#DFDDD0"
|
||||
android:pathData="M4.1492,11.792h16v2h-16z" />
|
||||
</vector>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_toolbar_style_strike_through_disabled" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_strike_through" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/ic_toolbar_style_strike_through_active" android:state_selected="true" />
|
||||
</selector>
|
|
@ -137,7 +137,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/bold">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/alignmentRightIcon"
|
||||
android:id="@+id/alignmentLeftIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -192,7 +192,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/strikethrough">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/alignmentLeftIcon"
|
||||
android:id="@+id/alignmentRightIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -211,6 +211,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/code">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/setUrlIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
|
18
core-ui/src/main/res/layout/tab_item_style_toolbar.xml
Normal file
18
core-ui/src/main/res/layout/tab_item_style_toolbar.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/tabText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/tab_style_toolbar_selector"
|
||||
android:fontFamily="@font/inter_medium"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="6dp"
|
||||
android:paddingStart="@dimen/dp_16"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingEnd="@dimen/dp_16"
|
||||
android:paddingBottom="3dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/selector_style_toolbar_tab_text_color"
|
||||
android:textSize="15sp"
|
||||
tools:text="Text" />
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:contentDescription="@string/content_description_close_button"
|
||||
android:src="@drawable/ic_close_round"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@color/white"
|
||||
app:tabIndicatorColor="@android:color/transparent"
|
||||
app:tabMode="auto"
|
||||
app:tabPaddingTop="0dp"
|
||||
app:tabPaddingBottom="0dp"
|
||||
app:tabPaddingEnd="0dp"
|
||||
app:tabPaddingStart="0dp"
|
||||
app:tabRippleColor="@null">
|
||||
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/close" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -20,7 +20,7 @@
|
|||
android:theme="@style/AppTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity android:name=".ScrollAndMove" />
|
||||
<activity android:name=".SpanActivity">
|
||||
<activity android:name=".StyleActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.agileburo.anytype.sample
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.agileburo.anytype.core_ui.common.Alignment
|
||||
import com.agileburo.anytype.core_ui.common.Markup
|
||||
import com.agileburo.anytype.core_ui.features.page.styling.StylingType
|
||||
import com.agileburo.anytype.core_ui.model.StyleConfig
|
||||
import com.agileburo.anytype.core_ui.state.ControlPanelState
|
||||
import kotlinx.android.synthetic.main.activity_style.*
|
||||
|
||||
class StyleActivity: AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_style)
|
||||
|
||||
findViewById<ImageView>(R.id.close).setOnClickListener {
|
||||
styleToolbar.hideWithAnimation()
|
||||
}
|
||||
|
||||
button.setOnClickListener {
|
||||
styleToolbar.update(
|
||||
config = StyleConfig(
|
||||
visibleTypes = listOf(
|
||||
StylingType.STYLE,
|
||||
StylingType.TEXT_COLOR,
|
||||
StylingType.BACKGROUND
|
||||
),
|
||||
enabledMarkup = listOf(
|
||||
Markup.Type.BOLD,
|
||||
Markup.Type.ITALIC,
|
||||
Markup.Type.STRIKETHROUGH,
|
||||
Markup.Type.KEYBOARD,
|
||||
Markup.Type.LINK
|
||||
),
|
||||
enabledAlignment = listOf(Alignment.START, Alignment.END)
|
||||
),
|
||||
props = ControlPanelState.Toolbar.Styling.Props(
|
||||
isBold = false,
|
||||
isItalic = false,
|
||||
isStrikethrough = true,
|
||||
isCode = false,
|
||||
isLinked = false,
|
||||
color = null,
|
||||
background = null,
|
||||
alignment = null
|
||||
)
|
||||
)
|
||||
styleToolbar.showWithAnimation()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
26
sample/src/main/res/layout/activity_style.xml
Normal file
26
sample/src/main/res/layout/activity_style.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Show Style Toolbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.agileburo.anytype.core_ui.widgets.toolbar.style.StyleToolbarWidget
|
||||
android:id="@+id/styleToolbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_203"
|
||||
android:background="@color/white"
|
||||
android:translationY="203dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Add table
Add a link
Reference in a new issue