From 80c5ddf7e151928220f0d4b3b4042aeb7b616a58 Mon Sep 17 00:00:00 2001 From: "Gleb Levinkov (p2p)" Date: Mon, 26 Jun 2023 01:32:13 +0800 Subject: [PATCH 1/5] PWN-8905 - UiKit. Informer view --- .../org/p2p/core/common/DrawableContainer.kt | 2 +- .../java/org/p2p/core/common/TextContainer.kt | 2 +- .../uikit/components/InformerViewCellModel.kt | 49 ++++++ .../p2p/uikit/components/UiKitInformerView.kt | 118 ++++++++++++++ .../uikit/components/informerViewDelegate.kt | 19 +++ .../kotlin/org/p2p/uikit/utils/SpanUtils.kt | 18 +- .../org/p2p/uikit/utils/TextViewExtensions.kt | 12 ++ .../uikit/utils/image/ImageViewCellModel.kt | 2 + .../p2p/uikit/utils/text/TextViewCellModel.kt | 19 ++- .../drawable/bg_rounded_solid_smoke_24.xml | 8 + .../layout/fragment_striga_iban_account.xml | 154 ++++++++++++++++++ .../main/res/layout/item_informer_view.xml | 6 + .../main/res/layout/view_informer_view.xml | 71 ++++++++ 13 files changed, 468 insertions(+), 12 deletions(-) create mode 100644 ui-kit/src/main/kotlin/org/p2p/uikit/components/InformerViewCellModel.kt create mode 100644 ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt create mode 100644 ui-kit/src/main/kotlin/org/p2p/uikit/components/informerViewDelegate.kt create mode 100644 ui-kit/src/main/res/drawable/bg_rounded_solid_smoke_24.xml create mode 100644 ui-kit/src/main/res/layout/fragment_striga_iban_account.xml create mode 100644 ui-kit/src/main/res/layout/item_informer_view.xml create mode 100644 ui-kit/src/main/res/layout/view_informer_view.xml diff --git a/core/src/main/java/org/p2p/core/common/DrawableContainer.kt b/core/src/main/java/org/p2p/core/common/DrawableContainer.kt index 3e90d45f0a..1d1612ab76 100644 --- a/core/src/main/java/org/p2p/core/common/DrawableContainer.kt +++ b/core/src/main/java/org/p2p/core/common/DrawableContainer.kt @@ -25,7 +25,7 @@ sealed class DrawableContainer : Parcelable { abstract fun applyTo(imageView: ImageView) @Parcelize - class Res(@DrawableRes private val drawableRes: Int) : DrawableContainer() { + class Res(@DrawableRes val drawableRes: Int) : DrawableContainer() { override fun applyTo(imageView: ImageView) { imageView.setImageResource(drawableRes) } diff --git a/core/src/main/java/org/p2p/core/common/TextContainer.kt b/core/src/main/java/org/p2p/core/common/TextContainer.kt index b01e852998..3dcce78eba 100644 --- a/core/src/main/java/org/p2p/core/common/TextContainer.kt +++ b/core/src/main/java/org/p2p/core/common/TextContainer.kt @@ -14,7 +14,7 @@ sealed class TextContainer { operator fun invoke(@StringRes textRes: Int, vararg args: Any) = ResParams(textRes, args.toList()) - operator fun invoke(text: String) = + operator fun invoke(text: CharSequence) = Raw(text) } diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/InformerViewCellModel.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/InformerViewCellModel.kt new file mode 100644 index 0000000000..3501897a0a --- /dev/null +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/InformerViewCellModel.kt @@ -0,0 +1,49 @@ +package org.p2p.uikit.components + +import androidx.annotation.ColorRes +import androidx.annotation.StringRes +import org.p2p.core.common.DrawableContainer +import org.p2p.core.common.TextContainer +import org.p2p.uikit.R +import org.p2p.uikit.model.AnyCellItem + +class InformerViewCellModel( + val leftIcon: LeftIconParams, + val title: TitleParams? = null, + val caption: TextContainer? = null, + val infoLine: InfoLineParams? = null, + val onViewClicked: ((item: InformerViewCellModel) -> Unit)? = null +) : AnyCellItem { + + class LeftIconParams( + val icon: DrawableContainer, + @ColorRes val iconTint: Int = R.color.icons_mountain, + @ColorRes val backgroundTint: Int = R.color.bg_mountain + ) { + constructor(iconRes: Int) : this(DrawableContainer.invoke(iconRes)) + } + + class TitleParams( + val value: TextContainer, + val titleIcon: DrawableContainer.Res? = null, + @ColorRes val titleIconTint: Int = R.color.icons_night + ) { + constructor(@StringRes valueRes: Int) : this(TextContainer.invoke(valueRes)) + } + + class InfoLineParams( + val value: TextContainer, + val position: InfoLinePosition, + @ColorRes val textColorRes: Int = R.color.text_mountain, + val onInfoLineClicked: ((value: CharSequence) -> Unit)? = null + ) { + enum class InfoLinePosition { + BOTTOM, CAPTION_LINE + } + + constructor( + @StringRes valueRes: Int, + position: InfoLinePosition + ) : this(TextContainer.invoke(valueRes), position) + } +} diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt new file mode 100644 index 0000000000..78e1df0c03 --- /dev/null +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt @@ -0,0 +1,118 @@ +package org.p2p.uikit.components + +import android.content.Context +import android.graphics.Color +import android.text.method.LinkMovementMethod +import android.util.AttributeSet +import android.view.Gravity +import android.widget.FrameLayout +import org.p2p.core.common.TextContainer +import org.p2p.uikit.R +import org.p2p.uikit.databinding.ViewInformerViewBinding +import org.p2p.uikit.utils.SpanUtils +import org.p2p.uikit.utils.drawable.DrawableCellModel +import org.p2p.uikit.utils.drawable.shape.shapeCircle +import org.p2p.uikit.utils.drawable.shapeDrawable +import org.p2p.uikit.utils.getColor +import org.p2p.uikit.utils.image.ImageViewCellModel +import org.p2p.uikit.utils.image.bind +import org.p2p.uikit.utils.inflateViewBinding +import org.p2p.uikit.utils.text.TextViewCellModel +import org.p2p.uikit.utils.text.bindOrGone + +class UiKitInformerView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : FrameLayout(context, attrs, defStyleAttr) { + private val binding = inflateViewBinding() + + fun bind(model: InformerViewCellModel) = with(binding) { + imageViewLeftIcon.bind(model.leftIcon.iconCellModel()) + textViewTitle.bindOrGone(model.title?.titleCellModel()) + textViewCaption.bindOrGone(model.captionCellModel()) + textViewCaption.movementMethod = LinkMovementMethod() + textViewCaption.highlightColor = Color.TRANSPARENT + if (model.infoLine?.position == InformerViewCellModel.InfoLineParams.InfoLinePosition.BOTTOM) { + textViewInfoLine.bindOrGone(model.infoLine.infoLineCellModel()) + model.infoLine.onInfoLineClicked?.also { listener -> + textViewInfoLine.setOnClickListener { + listener.invoke(model.infoLine.value.getString(context)) + } + } + } + + model.onViewClicked?.also { listener -> + setOnClickListener { listener(model) } + } + + } + + private fun InformerViewCellModel.LeftIconParams.iconCellModel(): ImageViewCellModel { + return ImageViewCellModel( + icon = icon, + iconTint = iconTint, + background = DrawableCellModel( + drawable = shapeDrawable(shapeCircle()), + tint = R.color.bg_cloud + ) + ) + } + + private fun InformerViewCellModel.TitleParams.titleCellModel(): TextViewCellModel.Raw? { + return TextViewCellModel.Raw( + text = value, + textAppearance = R.style.UiKit_TextAppearance_SemiBold_Text1, + textColor = R.color.text_night, + drawable = titleIcon, + drawableTint = titleIconTint, + drawableGravity = Gravity.RIGHT + ) + } + + private fun InformerViewCellModel.captionCellModel(): TextViewCellModel.Raw? { + return caption?.let { + val captionText = it.getString(context) + val resultCaptionText = + if (infoLine?.position == InformerViewCellModel.InfoLineParams.InfoLinePosition.CAPTION_LINE) { + buildCaptionPlusInfoLine(captionText, infoLine) + } else { + captionText + } + + TextViewCellModel.Raw( + text = TextContainer(resultCaptionText), + textAppearance = R.style.UiKit_TextAppearance_Regular_Text4, + textColor = R.color.text_night, + ) + } + } + + private fun buildCaptionPlusInfoLine( + caption: String, + infoLineParams: InformerViewCellModel.InfoLineParams + ): CharSequence { + val infoLineText = infoLineParams.value.getString(context) + val fullCaptionText = "$caption $infoLineText" + return infoLineParams.onInfoLineClicked?.let { listener -> + SpanUtils.highlightLinkNoUnderline( + commonText = fullCaptionText, + highlightedText = infoLineText, + color = getColor(infoLineParams.textColorRes), + onClick = { listener(infoLineText) } + ) + } ?: SpanUtils.highlightText( + commonText = fullCaptionText, + highlightedText = infoLineText, + color = getColor(infoLineParams.textColorRes), + ) + } + + private fun InformerViewCellModel.InfoLineParams.infoLineCellModel(): TextViewCellModel { + return TextViewCellModel.Raw( + text = value, + textAppearance = R.style.UiKit_TextAppearance_Regular_Text4, + textColor = textColorRes, + ) + } +} diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/informerViewDelegate.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/informerViewDelegate.kt new file mode 100644 index 0000000000..a3ce9bba0e --- /dev/null +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/informerViewDelegate.kt @@ -0,0 +1,19 @@ +package org.p2p.uikit.components + +import com.hannesdorfmann.adapterdelegates4.AdapterDelegate +import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding +import org.p2p.uikit.databinding.ItemInformerViewBinding +import org.p2p.uikit.model.AnyCellItem +import org.p2p.uikit.utils.inflateViewBinding + +fun informerViewDelegate( + inflateListener: ((financeBlock: UiKitInformerView) -> Unit)? = null, + onBindListener: ((view: UiKitInformerView, item: InformerViewCellModel) -> Unit)? = null, +): AdapterDelegate> = + adapterDelegateViewBinding( + viewBinding = { _, parent -> parent.inflateViewBinding(attachToRoot = false) }, + ) { + bind { + binding.root.bind(item) + } + } diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/SpanUtils.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/SpanUtils.kt index efb68ae429..b1e5726b61 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/SpanUtils.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/SpanUtils.kt @@ -12,29 +12,29 @@ import android.text.style.ForegroundColorSpan import android.text.style.StyleSpan import android.view.View import org.p2p.core.utils.emptyString -import org.p2p.uikit.R object SpanUtils { fun highlightLinkNoUnderline( - text: String, - linkToHighlight: String, - @ColorInt linkColor: Int, + commonText: String, + highlightedText: String, + @ColorInt color: Int, onClick: (View) -> Unit ): SpannableString { - val spannable = SpannableString(text) - val startIndex = text.indexOf(linkToHighlight) - val endIndex = startIndex + linkToHighlight.length + val spannable = SpannableString(commonText) + val startIndex = commonText.indexOf(highlightedText) + val endIndex = startIndex + highlightedText.length if (startIndex == -1) return spannable val clickableSpan = object : ClickableSpan() { override fun onClick(widget: View) { + widget.cancelPendingInputEvents() onClick(widget) } override fun updateDrawState(ds: TextPaint) { - ds.color = linkColor + ds.color = color ds.isUnderlineText = false } } @@ -81,7 +81,7 @@ object SpanUtils { } fun String.highlightPublicKey(context: Context): Spannable { - val color = context.getColor(R.color.text_night) + val color = context.getColor(org.p2p.uikit.R.color.text_night) val outPutColoredText: Spannable = SpannableString(this) outPutColoredText.setSpan(ForegroundColorSpan(color), 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) val endIndex = length - 4 diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/TextViewExtensions.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/TextViewExtensions.kt index 7b3b5d164d..7b4f10c8e7 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/TextViewExtensions.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/TextViewExtensions.kt @@ -29,3 +29,15 @@ infix fun TextView.withTextOrInvisible(text: CharSequence?) { fun TextView.setTextColorRes(@ColorRes color: Int) { setTextColor(context.getColor(color)) } + +fun TextView.setDrawableTint(@ColorRes colorRes: Int) { + // if in XML layout you use android:startDrawable or android:endDrawable + // you have to work with compoundDrawablesRelative array, + // textView.compoundDrawables contains drawables + // when they have been added with + // android:leftDrawable or android:rightDrawable attributes + val color = getColor(colorRes) + (compoundDrawables + compoundDrawablesRelative) + .filterNotNull() + .forEach { it.setTint(color) } +} diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/image/ImageViewCellModel.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/image/ImageViewCellModel.kt index c9cb7018fe..9ec9166b40 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/image/ImageViewCellModel.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/image/ImageViewCellModel.kt @@ -26,11 +26,13 @@ data class ImageViewCellModel( fun commonCircleImage( icon: DrawableContainer, + @ColorRes iconTint: Int? = null, @ColorRes backgroundTint: Int = R.color.icons_rain, @Px strokeWidth: Float = 0f, @ColorRes strokeColor: Int = android.R.color.transparent, ): ImageViewCellModel = ImageViewCellModel( icon = icon, + iconTint = iconTint, background = DrawableCellModel( drawable = shapeDrawable(shape = shapeCircle()), tint = backgroundTint, diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/text/TextViewCellModel.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/text/TextViewCellModel.kt index 8349c96bf3..e7448b4d3b 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/text/TextViewCellModel.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/text/TextViewCellModel.kt @@ -12,7 +12,9 @@ import android.graphics.Typeface import android.graphics.drawable.Drawable import android.text.TextUtils import android.util.TypedValue +import android.view.Gravity import android.widget.TextView +import org.p2p.core.common.DrawableContainer import org.p2p.core.common.TextContainer import org.p2p.core.common.bind import org.p2p.core.utils.insets.InitialViewPadding @@ -24,6 +26,7 @@ import org.p2p.uikit.utils.drawable.applyBackground import org.p2p.uikit.utils.drawable.shape.shapeRoundedAll import org.p2p.uikit.utils.drawable.shapeDrawable import org.p2p.uikit.utils.getColorStateList +import org.p2p.uikit.utils.setDrawableTint import org.p2p.uikit.utils.skeleton.SkeletonCellModel import org.p2p.uikit.utils.skeleton.SkeletonDrawable import org.p2p.uikit.utils.skeleton.bindSkeleton @@ -40,7 +43,11 @@ sealed interface TextViewCellModel : AnyCellItem { val badgeBackground: TextViewBackgroundModel? = null, val autoSizeConfiguration: TextViewAutoSizeConfiguration? = null, val maxLines: Int? = null, - val ellipsize: TextUtils.TruncateAt? = null + val ellipsize: TextUtils.TruncateAt? = null, + val drawable: DrawableContainer.Res? = null, + @ColorRes val drawableTint: Int? = null, + // android.view.Gravity + val drawableGravity: Int = Gravity.RIGHT ) : TextViewCellModel data class Skeleton( @@ -152,6 +159,16 @@ fun TextView.bind(model: TextViewCellModel.Raw) { ) } + model.drawable?.also { + setCompoundDrawablesWithIntrinsicBounds( + it.drawableRes.takeIf { model.drawableGravity == Gravity.LEFT } ?: 0, + it.drawableRes.takeIf { model.drawableGravity == Gravity.TOP } ?: 0, + it.drawableRes.takeIf { model.drawableGravity == Gravity.RIGHT } ?: 0, + it.drawableRes.takeIf { model.drawableGravity == Gravity.BOTTOM } ?: 0 + ) + model.drawableTint?.also(::setDrawableTint) + } + updatePadding( left = model.badgeBackground?.padding?.left.orZero(), top = model.badgeBackground?.padding?.top.orZero(), diff --git a/ui-kit/src/main/res/drawable/bg_rounded_solid_smoke_24.xml b/ui-kit/src/main/res/drawable/bg_rounded_solid_smoke_24.xml new file mode 100644 index 0000000000..f3b8115dee --- /dev/null +++ b/ui-kit/src/main/res/drawable/bg_rounded_solid_smoke_24.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/ui-kit/src/main/res/layout/fragment_striga_iban_account.xml b/ui-kit/src/main/res/layout/fragment_striga_iban_account.xml new file mode 100644 index 0000000000..84a7311ece --- /dev/null +++ b/ui-kit/src/main/res/layout/fragment_striga_iban_account.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui-kit/src/main/res/layout/item_informer_view.xml b/ui-kit/src/main/res/layout/item_informer_view.xml new file mode 100644 index 0000000000..3aaca181f5 --- /dev/null +++ b/ui-kit/src/main/res/layout/item_informer_view.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/ui-kit/src/main/res/layout/view_informer_view.xml b/ui-kit/src/main/res/layout/view_informer_view.xml new file mode 100644 index 0000000000..73e309a3c8 --- /dev/null +++ b/ui-kit/src/main/res/layout/view_informer_view.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + From c93502592fcf2b7205763e2e8a863bd8d4c8958f Mon Sep 17 00:00:00 2001 From: "Gleb Levinkov (p2p)" Date: Mon, 26 Jun 2023 15:06:14 +0800 Subject: [PATCH 2/5] PWN-8905 - Polish informer view --- .../debug/settings/DebugSettingsFragment.kt | 6 +- .../debug/settings/DebugSettingsMapper.kt | 5 + .../debug/uikit/DebugInformerViewBuilder.kt | 160 ++++++++++++++++++ .../debug/uikit/DebugUiKitFragmentContract.kt | 15 ++ .../debug/uikit/DebugUiKitFragmentFragment.kt | 39 +++++ .../uikit/DebugUiKitFragmentPresenter.kt | 17 ++ .../main/res/layout/fragment_debug_ui_kit.xml | 17 ++ app/src/main/res/values/settings_strings.xml | 1 + .../p2p/uikit/components/UiKitInformerView.kt | 102 ++++++++--- .../uikit/utils/recycler/AdapterExtensions.kt | 2 +- .../main/res/layout/item_informer_view.xml | 5 +- ui-kit/src/main/res/values/attrs.xml | 18 +- 12 files changed, 361 insertions(+), 26 deletions(-) create mode 100644 app/src/main/java/org/p2p/wallet/debug/uikit/DebugInformerViewBuilder.kt create mode 100644 app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentContract.kt create mode 100644 app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentFragment.kt create mode 100644 app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentPresenter.kt create mode 100644 app/src/main/res/layout/fragment_debug_ui_kit.xml diff --git a/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsFragment.kt b/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsFragment.kt index 1dedb2826c..801e26e10b 100644 --- a/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsFragment.kt +++ b/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsFragment.kt @@ -4,6 +4,7 @@ import androidx.annotation.StringRes import android.os.Bundle import android.view.View import org.koin.android.ext.android.inject +import org.p2p.core.network.environment.NetworkEnvironment import org.p2p.uikit.utils.attachAdapter import org.p2p.wallet.R import org.p2p.wallet.common.mvp.BaseMvpFragment @@ -23,7 +24,7 @@ import org.p2p.wallet.debug.settings.adapter.settingsRowSectionItemDelegate import org.p2p.wallet.debug.settings.adapter.settingsRowSwtichItemDelegate import org.p2p.wallet.debug.settings.adapter.settingsRowTitleItemDelegate import org.p2p.wallet.debug.torus.DebugTorusFragment -import org.p2p.core.network.environment.NetworkEnvironment +import org.p2p.wallet.debug.uikit.DebugUiKitFragmentFragment import org.p2p.wallet.settings.model.SettingsRow import org.p2p.wallet.settings.ui.network.SettingsNetworkBottomSheet import org.p2p.wallet.utils.getSerializableOrNull @@ -115,6 +116,9 @@ class DebugSettingsFragment : R.string.debug_settings_striga_detach_user_id_title -> { presenter.onClickDetachStrigaUser() } + R.string.debug_settings_ui_kit -> { + replaceFragment(DebugUiKitFragmentFragment()) + } } } diff --git a/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsMapper.kt b/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsMapper.kt index 6bd0f45c2c..5b2cead705 100644 --- a/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsMapper.kt +++ b/app/src/main/java/org/p2p/wallet/debug/settings/DebugSettingsMapper.kt @@ -54,6 +54,11 @@ class DebugSettingsMapper( } this += createStrigaSettings() + + this += SettingsRow.Section( + titleResId = R.string.debug_settings_ui_kit, + iconRes = R.drawable.ic_settings_cloud + ) } private fun createEnvironmentSettings(): List = buildList { diff --git a/app/src/main/java/org/p2p/wallet/debug/uikit/DebugInformerViewBuilder.kt b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugInformerViewBuilder.kt new file mode 100644 index 0000000000..4b664d5fc5 --- /dev/null +++ b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugInformerViewBuilder.kt @@ -0,0 +1,160 @@ +package org.p2p.wallet.debug.uikit + +import androidx.annotation.DrawableRes +import org.p2p.core.common.DrawableContainer +import org.p2p.core.common.TextContainer +import org.p2p.uikit.components.InformerViewCellModel +import org.p2p.uikit.model.AnyCellItem +import org.p2p.uikit.organisms.sectionheader.SectionHeaderCellModel +import org.p2p.wallet.R + +class DebugInformerViewBuilder { + fun build( + onInfoLineClicked: () -> Unit + ): List = listOf( + SectionHeaderCellModel( + sectionTitle = TextContainer("Informer view row 1"), + isShevronVisible = false + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + title = InformerViewCellModel.TitleParams( + value = "Account creation fee".wrap(), + titleIcon = R.drawable.ic_info_solid.wrap() + ), + caption = "0.028813 USDC".wrap(), + infoLine = InformerViewCellModel.InfoLineParams( + value = "Info line".wrap(), + position = InformerViewCellModel.InfoLineParams.InfoLinePosition.BOTTOM, + onInfoLineClicked = { onInfoLineClicked() } + ), + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + title = InformerViewCellModel.TitleParams( + "Account creation fee".wrap(), + R.drawable.ic_info_solid.wrap() + ), + caption = "0.028813 USDC".wrap(), + infoLine = InformerViewCellModel.InfoLineParams( + value = "(\$0.03)".wrap(), + position = InformerViewCellModel.InfoLineParams.InfoLinePosition.CAPTION_LINE, + textColorRes = R.color.text_sky, + onInfoLineClicked = { onInfoLineClicked() } + ) + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + title = InformerViewCellModel.TitleParams( + "Account creation fee".wrap(), + R.drawable.ic_info_solid.wrap() + ), + caption = "0.028813 USDC".wrap(), + ) + ) + + + listOf( + SectionHeaderCellModel( + sectionTitle = TextContainer("Informer view row 2"), + isShevronVisible = false + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + title = InformerViewCellModel.TitleParams( + value = "Account creation fee".wrap(), + ), + caption = "0.028813 USDC".wrap(), + infoLine = InformerViewCellModel.InfoLineParams( + value = "Info line".wrap(), + position = InformerViewCellModel.InfoLineParams.InfoLinePosition.BOTTOM, + onInfoLineClicked = { onInfoLineClicked() } + ), + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + title = InformerViewCellModel.TitleParams( + value = "Account creation fee".wrap(), + ), + caption = "0.028813 USDC".wrap(), + infoLine = InformerViewCellModel.InfoLineParams( + value = "(\$0.03)".wrap(), + position = InformerViewCellModel.InfoLineParams.InfoLinePosition.CAPTION_LINE, + textColorRes = R.color.text_sky, + onInfoLineClicked = { onInfoLineClicked() } + ) + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + title = InformerViewCellModel.TitleParams( + value = "Account creation fee".wrap(), + ), + caption = "0.028813 USDC".wrap(), + ), + ) + + + listOf( + SectionHeaderCellModel( + sectionTitle = TextContainer("Informer view row 3"), + isShevronVisible = false + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + caption = "0.028813 USDC".wrap(), + infoLine = InformerViewCellModel.InfoLineParams( + value = "Info line".wrap(), + position = InformerViewCellModel.InfoLineParams.InfoLinePosition.BOTTOM, + onInfoLineClicked = { onInfoLineClicked() } + ), + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + caption = "The minimum amount you will receive. If the price slips any further ".wrap(), + infoLine = InformerViewCellModel.InfoLineParams( + value = "(\$0.03)".wrap(), + position = InformerViewCellModel.InfoLineParams.InfoLinePosition.CAPTION_LINE, + textColorRes = R.color.text_sky, + onInfoLineClicked = { onInfoLineClicked() } + ) + ), + InformerViewCellModel( + leftIcon = InformerViewCellModel.LeftIconParams( + icon = R.drawable.ic_checkbox_checked.wrap(), + iconTint = R.color.icons_night + ), + caption = buildString { + append("The minimum amount you will receive. ") + append("If the price slips any further, your transaction will revert.") + }.wrap(), + ), + ) + + private fun @receiver:DrawableRes Int.wrap(): DrawableContainer.Res = + DrawableContainer.invoke(this) + + private fun String.wrap(): TextContainer.Raw = + TextContainer.Raw(this) +} diff --git a/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentContract.kt b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentContract.kt new file mode 100644 index 0000000000..c5348749ab --- /dev/null +++ b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentContract.kt @@ -0,0 +1,15 @@ +package org.p2p.wallet.debug.uikit + +import org.p2p.uikit.model.AnyCellItem +import org.p2p.wallet.common.mvp.MvpPresenter +import org.p2p.wallet.common.mvp.MvpView + +interface DebugUiKitFragmentContract { + interface View : MvpView { + fun showViews(items: List) + } + + interface Presenter : MvpPresenter { + fun buildInformerViews() + } +} diff --git a/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentFragment.kt b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentFragment.kt new file mode 100644 index 0000000000..b3f81ad7e7 --- /dev/null +++ b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentFragment.kt @@ -0,0 +1,39 @@ +package org.p2p.wallet.debug.uikit + +import android.os.Bundle +import android.view.View +import org.p2p.uikit.components.informerViewDelegate +import org.p2p.uikit.model.AnyCellItem +import org.p2p.uikit.organisms.sectionheader.sectionHeaderCellDelegate +import org.p2p.uikit.utils.attachAdapter +import org.p2p.wallet.R +import org.p2p.wallet.common.adapter.CommonAnyCellAdapter +import org.p2p.wallet.common.mvp.BaseMvpFragment +import org.p2p.wallet.databinding.FragmentDebugUiKitBinding +import org.p2p.wallet.utils.viewbinding.viewBinding + +class DebugUiKitFragmentFragment : + BaseMvpFragment( + R.layout.fragment_debug_ui_kit + ), + DebugUiKitFragmentContract.View { + + override val presenter: DebugUiKitFragmentContract.Presenter = DebugUiKitFragmentPresenter() + + private val binding: FragmentDebugUiKitBinding by viewBinding() + private val adapter = CommonAnyCellAdapter( + sectionHeaderCellDelegate(), + informerViewDelegate() + ) + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + binding.recyclerViewUiKitViews.attachAdapter(adapter) + + presenter.buildInformerViews() + } + + override fun showViews(items: List) { + adapter.items = items + } +} diff --git a/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentPresenter.kt b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentPresenter.kt new file mode 100644 index 0000000000..8f009b42de --- /dev/null +++ b/app/src/main/java/org/p2p/wallet/debug/uikit/DebugUiKitFragmentPresenter.kt @@ -0,0 +1,17 @@ +package org.p2p.wallet.debug.uikit + +import org.p2p.wallet.common.mvp.BasePresenter + +class DebugUiKitFragmentPresenter : + BasePresenter(), + DebugUiKitFragmentContract.Presenter { + private val informerViewBuilder = DebugInformerViewBuilder() + + override fun buildInformerViews() { + view?.showViews( + informerViewBuilder.build( + onInfoLineClicked = { view?.showUiKitSnackBar("informer view clicked") } + ) + ) + } +} diff --git a/app/src/main/res/layout/fragment_debug_ui_kit.xml b/app/src/main/res/layout/fragment_debug_ui_kit.xml new file mode 100644 index 0000000000..598aee2aaf --- /dev/null +++ b/app/src/main/res/layout/fragment_debug_ui_kit.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/app/src/main/res/values/settings_strings.xml b/app/src/main/res/values/settings_strings.xml index 6395beb7af..38b69953db 100644 --- a/app/src/main/res/values/settings_strings.xml +++ b/app/src/main/res/values/settings_strings.xml @@ -21,6 +21,7 @@ KYC Banner mock KYC Simulate rejected Detach striga from web3 user + UiKit examples Debug Notifications diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt index 78e1df0c03..f3704e686b 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt @@ -1,13 +1,17 @@ package org.p2p.uikit.components +import androidx.core.content.res.use +import androidx.core.view.isVisible import android.content.Context import android.graphics.Color import android.text.method.LinkMovementMethod import android.util.AttributeSet import android.view.Gravity import android.widget.FrameLayout +import org.p2p.core.common.DrawableContainer import org.p2p.core.common.TextContainer import org.p2p.uikit.R +import org.p2p.uikit.components.InformerViewCellModel.InfoLineParams.InfoLinePosition import org.p2p.uikit.databinding.ViewInformerViewBinding import org.p2p.uikit.utils.SpanUtils import org.p2p.uikit.utils.drawable.DrawableCellModel @@ -18,6 +22,7 @@ import org.p2p.uikit.utils.image.ImageViewCellModel import org.p2p.uikit.utils.image.bind import org.p2p.uikit.utils.inflateViewBinding import org.p2p.uikit.utils.text.TextViewCellModel +import org.p2p.uikit.utils.text.bind import org.p2p.uikit.utils.text.bindOrGone class UiKitInformerView @JvmOverloads constructor( @@ -27,25 +32,73 @@ class UiKitInformerView @JvmOverloads constructor( ) : FrameLayout(context, attrs, defStyleAttr) { private val binding = inflateViewBinding() + init { + context.obtainStyledAttributes(attrs, R.styleable.UiKitInformerView).use { style -> + val leftIconRes: Int = style.getResourceId(R.styleable.UiKitInformerView_leftIcon, R.drawable.ic_checkbox_checked) + val leftIconTint: Int? = style.getResourceId(R.styleable.UiKitInformerView_leftIconTint, -1) + .takeIf { it != -1 } + val title: String? = style.getString(R.styleable.UiKitInformerView_title) + val caption: String? = style.getString(R.styleable.UiKitInformerView_caption) + val infoLine: String? = style.getString(R.styleable.UiKitInformerView_infoLine) + val infoLinePosition = style.getInt(R.styleable.UiKitInformerView_infoLinePosition, -1) + .takeIf { it != -1 } + ?.let { InfoLinePosition.values()[it] } + + val leftIconParams = if (leftIconTint != null) { + InformerViewCellModel.LeftIconParams( + DrawableContainer(iconRes = leftIconRes), + iconTint = leftIconTint + ) + } else { + InformerViewCellModel.LeftIconParams(leftIconRes) + } + + InformerViewCellModel( + leftIcon = leftIconParams, + title = title?.let { InformerViewCellModel.TitleParams(TextContainer(it)) }, + caption = caption?.let { TextContainer(it) }, + infoLine = infoLine?.let { + InformerViewCellModel.InfoLineParams( + TextContainer(text = it), + position = infoLinePosition!! + ) + } + ) + .also(::bind) + } + } + fun bind(model: InformerViewCellModel) = with(binding) { imageViewLeftIcon.bind(model.leftIcon.iconCellModel()) textViewTitle.bindOrGone(model.title?.titleCellModel()) textViewCaption.bindOrGone(model.captionCellModel()) - textViewCaption.movementMethod = LinkMovementMethod() - textViewCaption.highlightColor = Color.TRANSPARENT - if (model.infoLine?.position == InformerViewCellModel.InfoLineParams.InfoLinePosition.BOTTOM) { - textViewInfoLine.bindOrGone(model.infoLine.infoLineCellModel()) - model.infoLine.onInfoLineClicked?.also { listener -> - textViewInfoLine.setOnClickListener { - listener.invoke(model.infoLine.value.getString(context)) - } - } - } + bindInfoLine(model) model.onViewClicked?.also { listener -> setOnClickListener { listener(model) } } + } + private fun bindInfoLine(model: InformerViewCellModel) = with(binding){ + when (model.infoLine?.position) { + InfoLinePosition.BOTTOM -> { + textViewInfoLine.bind(model.infoLine.infoLineCellModel()) + textViewInfoLine.setOnClickListener { + model.infoLine.onInfoLineClicked?.invoke(model.infoLine.value.getString(context)) + } + } + InfoLinePosition.CAPTION_LINE -> { + requireNotNull(model.caption) { "You can't put an info line on caption if there no caption" } + textViewCaption.movementMethod = LinkMovementMethod() + textViewCaption.highlightColor = Color.TRANSPARENT + + textViewCaption.bind(captionPlusInfoLineCellModel(model.caption, model.infoLine)) + textViewInfoLine.isVisible = false + } + null -> { + textViewInfoLine.isVisible = false + } + } } private fun InformerViewCellModel.LeftIconParams.iconCellModel(): ImageViewCellModel { @@ -59,7 +112,7 @@ class UiKitInformerView @JvmOverloads constructor( ) } - private fun InformerViewCellModel.TitleParams.titleCellModel(): TextViewCellModel.Raw? { + private fun InformerViewCellModel.TitleParams.titleCellModel(): TextViewCellModel.Raw { return TextViewCellModel.Raw( text = value, textAppearance = R.style.UiKit_TextAppearance_SemiBold_Text1, @@ -72,28 +125,33 @@ class UiKitInformerView @JvmOverloads constructor( private fun InformerViewCellModel.captionCellModel(): TextViewCellModel.Raw? { return caption?.let { - val captionText = it.getString(context) - val resultCaptionText = - if (infoLine?.position == InformerViewCellModel.InfoLineParams.InfoLinePosition.CAPTION_LINE) { - buildCaptionPlusInfoLine(captionText, infoLine) - } else { - captionText - } - TextViewCellModel.Raw( - text = TextContainer(resultCaptionText), + text = it, textAppearance = R.style.UiKit_TextAppearance_Regular_Text4, textColor = R.color.text_night, ) } } + private fun captionPlusInfoLineCellModel( + caption: TextContainer, + infoLineParams: InformerViewCellModel.InfoLineParams + ): TextViewCellModel.Raw { + val resultCaption = buildCaptionPlusInfoLine(caption, infoLineParams) + return TextViewCellModel.Raw( + text = TextContainer(resultCaption), + textAppearance = R.style.UiKit_TextAppearance_Regular_Text4, + textColor = R.color.text_night, + ) + } + private fun buildCaptionPlusInfoLine( - caption: String, + caption: TextContainer, infoLineParams: InformerViewCellModel.InfoLineParams ): CharSequence { val infoLineText = infoLineParams.value.getString(context) - val fullCaptionText = "$caption $infoLineText" + val captionText = caption.getString(context) + val fullCaptionText = "$captionText $infoLineText" return infoLineParams.onInfoLineClicked?.let { listener -> SpanUtils.highlightLinkNoUnderline( commonText = fullCaptionText, diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/recycler/AdapterExtensions.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/recycler/AdapterExtensions.kt index b4ca825298..816285ae13 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/utils/recycler/AdapterExtensions.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/utils/recycler/AdapterExtensions.kt @@ -4,7 +4,7 @@ import androidx.recyclerview.widget.RecyclerView import com.hannesdorfmann.adapterdelegates4.AsyncListDifferDelegationAdapter import com.hannesdorfmann.adapterdelegates4.ListDelegationAdapter import org.p2p.uikit.model.AnyCellItem - +@Suppress("UNCHECKED_CAST") fun RecyclerView.Adapter<*>.getItems(): List { return when (this) { is AsyncListDifferDelegationAdapter<*> -> items as List diff --git a/ui-kit/src/main/res/layout/item_informer_view.xml b/ui-kit/src/main/res/layout/item_informer_view.xml index 3aaca181f5..e6dbb3bf9d 100644 --- a/ui-kit/src/main/res/layout/item_informer_view.xml +++ b/ui-kit/src/main/res/layout/item_informer_view.xml @@ -3,4 +3,7 @@ android:id="@+id/root" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="wrap_content" /> \ No newline at end of file + android:layout_height="wrap_content" + xmlns:tools="http://schemas.android.com/tools" + tools:title="Account creation fee" + tools:caption="0.2222 USDC" /> \ No newline at end of file diff --git a/ui-kit/src/main/res/values/attrs.xml b/ui-kit/src/main/res/values/attrs.xml index ccb794710f..95968958d7 100644 --- a/ui-kit/src/main/res/values/attrs.xml +++ b/ui-kit/src/main/res/values/attrs.xml @@ -43,6 +43,7 @@ + @@ -67,7 +68,7 @@ - + @@ -111,5 +112,20 @@ + + + + + + + + + + + + + + + From de9e166327da2c9ff24b2f9c02d8787a38385e23 Mon Sep 17 00:00:00 2001 From: "Gleb Levinkov (p2p)" Date: Mon, 26 Jun 2023 15:11:14 +0800 Subject: [PATCH 3/5] PWN-8905 - deprecate old view --- .../p2p/uikit/components/UiKitInformerView.kt | 16 ++++++++++++++-- .../components/info_block/InfoBlockCellModel.kt | 5 ++++- .../components/info_block/UiKitInfoBlockView.kt | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt index f3704e686b..caa6e61331 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/UiKitInformerView.kt @@ -25,6 +25,14 @@ import org.p2p.uikit.utils.text.TextViewCellModel import org.p2p.uikit.utils.text.bind import org.p2p.uikit.utils.text.bindOrGone +/** + * https://www.figma.com/file/13KdUCrfZ6VPBdfT6sLVbi/Android-UI-Kit?type=design&node-id=2148-61961&mode=dev + * Can be initialized two ways: + * 1) Place it as a part of the list, use informerViewDelegate, create InformerViewCellModels + * 2) Use it statically in layout - pass all the needed attrs from R.styleable.UiKitInformerView + * + * disclaimer: this custom view may not be fully finished, feel free to add stuff that I forgot to add + */ class UiKitInformerView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, @@ -34,7 +42,8 @@ class UiKitInformerView @JvmOverloads constructor( init { context.obtainStyledAttributes(attrs, R.styleable.UiKitInformerView).use { style -> - val leftIconRes: Int = style.getResourceId(R.styleable.UiKitInformerView_leftIcon, R.drawable.ic_checkbox_checked) + val leftIconRes: Int = + style.getResourceId(R.styleable.UiKitInformerView_leftIcon, R.drawable.ic_checkbox_checked) val leftIconTint: Int? = style.getResourceId(R.styleable.UiKitInformerView_leftIconTint, -1) .takeIf { it != -1 } val title: String? = style.getString(R.styleable.UiKitInformerView_title) @@ -79,7 +88,7 @@ class UiKitInformerView @JvmOverloads constructor( } } - private fun bindInfoLine(model: InformerViewCellModel) = with(binding){ + private fun bindInfoLine(model: InformerViewCellModel) = with(binding) { when (model.infoLine?.position) { InfoLinePosition.BOTTOM -> { textViewInfoLine.bind(model.infoLine.infoLineCellModel()) @@ -145,6 +154,9 @@ class UiKitInformerView @JvmOverloads constructor( ) } + /** + * In case of info line position in line with caption - add concatenate both texts + */ private fun buildCaptionPlusInfoLine( caption: TextContainer, infoLineParams: InformerViewCellModel.InfoLineParams diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/InfoBlockCellModel.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/InfoBlockCellModel.kt index 84bc77f06b..a866319533 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/InfoBlockCellModel.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/InfoBlockCellModel.kt @@ -9,7 +9,10 @@ import org.p2p.uikit.utils.drawable.shape.shapeRoundedAll import org.p2p.uikit.utils.drawable.shapeDrawable import org.p2p.uikit.utils.text.TextViewCellModel import org.p2p.uikit.utils.toPx - +@Deprecated( + "not fully implemented", + replaceWith = ReplaceWith("InformerViewCellModel") +) data class InfoBlockCellModel( val icon: IconWrapperCellModel? = null, val firstLineText: TextViewCellModel? = null, diff --git a/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/UiKitInfoBlockView.kt b/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/UiKitInfoBlockView.kt index 4677ce3241..f420e2e839 100644 --- a/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/UiKitInfoBlockView.kt +++ b/ui-kit/src/main/kotlin/org/p2p/uikit/components/info_block/UiKitInfoBlockView.kt @@ -11,6 +11,10 @@ import org.p2p.uikit.utils.inflateViewBinding import org.p2p.uikit.utils.text.bindOrGone import org.p2p.uikit.utils.toPx +@Deprecated( + "not fully implemented", + replaceWith = ReplaceWith("UiKitInformerView") +) class UiKitInfoBlockView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null From 3c57d6a6031975b259dbbfa47c5acb784b309c52 Mon Sep 17 00:00:00 2001 From: "Gleb Levinkov (p2p)" Date: Mon, 26 Jun 2023 15:13:24 +0800 Subject: [PATCH 4/5] PWN-8905 - comment fixes --- .../HistorySendLinkDetailsBottomSheet.kt | 2 +- .../onboarding/StrigaOnboardingFragment.kt | 6 +- .../main/res/values/send_via_link_strings.xml | 2 +- .../layout/fragment_striga_iban_account.xml | 154 ------------------ 4 files changed, 5 insertions(+), 159 deletions(-) delete mode 100644 ui-kit/src/main/res/layout/fragment_striga_iban_account.xml diff --git a/app/src/main/java/org/p2p/wallet/history/ui/sendvialink/HistorySendLinkDetailsBottomSheet.kt b/app/src/main/java/org/p2p/wallet/history/ui/sendvialink/HistorySendLinkDetailsBottomSheet.kt index e166b6b5b5..a83750d876 100644 --- a/app/src/main/java/org/p2p/wallet/history/ui/sendvialink/HistorySendLinkDetailsBottomSheet.kt +++ b/app/src/main/java/org/p2p/wallet/history/ui/sendvialink/HistorySendLinkDetailsBottomSheet.kt @@ -134,7 +134,7 @@ class HistorySendLinkDetailsBottomSheet : financeBlockLinkValue.rightSideView.setOnClickListener { historyAnalytics.logUserSendLinkCopyClicked() requireContext().copyToClipBoard(state.link) - showUiKitSnackBar(messageResId = R.string.send_via_link_generation_copied) + showUiKitSnackBar(messageResId = R.string.general_copied) } buttonShare.setOnClickListener { historyAnalytics.logUserSendLinkShareClicked() diff --git a/app/src/main/java/org/p2p/wallet/striga/onboarding/StrigaOnboardingFragment.kt b/app/src/main/java/org/p2p/wallet/striga/onboarding/StrigaOnboardingFragment.kt index 6fec07549f..77e9821ac0 100644 --- a/app/src/main/java/org/p2p/wallet/striga/onboarding/StrigaOnboardingFragment.kt +++ b/app/src/main/java/org/p2p/wallet/striga/onboarding/StrigaOnboardingFragment.kt @@ -123,9 +123,9 @@ class StrigaOnboardingFragment : val helpHighlightText = getString(R.string.striga_onboarding_help_highlight_text) val helpCommonText = getString(R.string.striga_onboarding_help_common_text, helpHighlightText) val helpTextSpannable = SpanUtils.highlightLinkNoUnderline( - text = helpCommonText, - linkToHighlight = helpHighlightText, - linkColor = getColor(R.color.sky), + commonText = helpCommonText, + highlightedText = helpHighlightText, + color = getColor(R.color.sky), onClick = { presenter.onClickHelp() } ) diff --git a/app/src/main/res/values/send_via_link_strings.xml b/app/src/main/res/values/send_via_link_strings.xml index cd5767434a..eb527c89f2 100644 --- a/app/src/main/res/values/send_via_link_strings.xml +++ b/app/src/main/res/values/send_via_link_strings.xml @@ -9,7 +9,7 @@ Share your link to send money If you want to get your money back just open the link by yourself You have reached the daily limit of sending free links. Try tomorrow - ✅ Copied + ✅ Copied Hey, I\'ve sent you %1s! Get it here: \n%2s Without account details diff --git a/ui-kit/src/main/res/layout/fragment_striga_iban_account.xml b/ui-kit/src/main/res/layout/fragment_striga_iban_account.xml deleted file mode 100644 index 84a7311ece..0000000000 --- a/ui-kit/src/main/res/layout/fragment_striga_iban_account.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From e8c649db63b793c2de126728682e572531a75bdd Mon Sep 17 00:00:00 2001 From: "Gleb Levinkov (p2p)" Date: Mon, 26 Jun 2023 16:19:41 +0800 Subject: [PATCH 5/5] PWN-8905 - comment fixes --- .../svl/ui/linkresult/SendLinkGenerationResultFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/p2p/wallet/svl/ui/linkresult/SendLinkGenerationResultFragment.kt b/app/src/main/java/org/p2p/wallet/svl/ui/linkresult/SendLinkGenerationResultFragment.kt index a41def3812..4f54eb616c 100644 --- a/app/src/main/java/org/p2p/wallet/svl/ui/linkresult/SendLinkGenerationResultFragment.kt +++ b/app/src/main/java/org/p2p/wallet/svl/ui/linkresult/SendLinkGenerationResultFragment.kt @@ -74,7 +74,7 @@ class SendLinkGenerationResultFragment : BaseFragment(R.layout.fragment_send_lin imageViewCopy.setOnClickListener { svlAnalytics.logLinkCopyIconClicked() requireContext().copyToClipBoard(state.formattedLink) - showUiKitSnackBar(messageResId = R.string.send_via_link_generation_copied) + showUiKitSnackBar(messageResId = R.string.general_copied) } } is LinkGenerationState.Error -> {