diff --git a/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/Component.kt b/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/Component.kt index ddbd3ac8421e..8ae0b1505848 100644 --- a/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/Component.kt +++ b/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/Component.kt @@ -32,6 +32,7 @@ enum class Component { BOTTOM_APP_BAR, TABS, SNACKBAR, + REMOTE_MESSAGE, INFO_PANEL, DIALOG, BOTTOM_SHEET, diff --git a/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/ComponentViewHolder.kt b/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/ComponentViewHolder.kt index 2337060fd6a3..d4cd25705dc7 100644 --- a/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/ComponentViewHolder.kt +++ b/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/ComponentViewHolder.kt @@ -24,6 +24,8 @@ import android.view.ViewGroup import android.widget.FrameLayout import androidx.recyclerview.widget.RecyclerView import com.duckduckgo.mobile.android.R +import com.duckduckgo.mobile.android.ui.view.MessageCta +import com.duckduckgo.mobile.android.ui.view.MessageCta.Message import com.duckduckgo.mobile.android.ui.view.listitem.OneLineListItem import com.duckduckgo.mobile.android.ui.view.listitem.SectionHeaderListItem import com.duckduckgo.mobile.android.ui.view.listitem.TwoLineListItem @@ -60,6 +62,61 @@ sealed class ComponentViewHolder(val view: View) : RecyclerView.ViewHolder(view) parent: ViewGroup, ) : ComponentViewHolder(inflate(parent, R.layout.component_info_panel)) + class RemoteMessageComponentViewHolder( + parent: ViewGroup, + ) : ComponentViewHolder(inflate(parent, R.layout.component_remote_message)) { + override fun bind(component: Component) { + val smallMessage = Message(title = "Small Message", subtitle = "Body text goes here. This component doesn't have buttons") + val bigSingleMessage = Message( + illustration = R.drawable.ic_announce, + title = "Big Single Message", + subtitle = "Body text goes here. This component has one button", + action = "Primary", + ) + val bigTwoActionsMessage = Message( + illustration = R.drawable.ic_ddg_announce, + title = "Big Two Actions Message", + subtitle = "Body text goes here. This component has two buttons", + action = "Primary", + action2 = "Secondary", + ) + + val bigTwoActionsUpdateMessage = Message( + illustration = R.drawable.ic_app_update, + title = "Big Two Actions Message", + subtitle = "Body text goes here. This component has two buttons and showcases and app update", + action = "Primary", + action2 = "Secondary", + ) + + val mediumMessage = Message( + illustration = R.drawable.ic_critical_update, + title = "Big Single Message", + subtitle = "Body text goes here. This component has one button", + ) + + view.findViewById(R.id.small_remote_message).apply { + setMessage(smallMessage) + } + + view.findViewById(R.id.medium_remote_message).apply { + setMessage(mediumMessage) + } + + view.findViewById(R.id.big_single_remote_message).apply { + setMessage(bigSingleMessage) + } + + view.findViewById(R.id.big_two_actions_remote_message).apply { + setMessage(bigTwoActionsMessage) + } + + view.findViewById(R.id.big_two_actions_update_remote_message).apply { + setMessage(bigTwoActionsUpdateMessage) + } + } + } + class SearchBarComponentViewHolder( parent: ViewGroup, ) : ComponentViewHolder(inflate(parent, R.layout.component_search_bar)) @@ -236,6 +293,7 @@ sealed class ComponentViewHolder(val view: View) : RecyclerView.ViewHolder(view) Component.SLIDER -> SliderComponentViewHolder(parent) Component.SNACKBAR -> SnackbarComponentViewHolder(parent) Component.INFO_PANEL -> InfoPanelComponentViewHolder(parent) + Component.REMOTE_MESSAGE -> RemoteMessageComponentViewHolder(parent) Component.SEARCH_BAR -> SearchBarComponentViewHolder(parent) Component.MENU_ITEM -> MenuItemComponentViewHolder(parent) Component.SECTION_HEADER_LIST_ITEM -> HeaderSectionComponentViewHolder(parent) diff --git a/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/navigation/ComponentMessagingFragment.kt b/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/navigation/ComponentMessagingFragment.kt index 8b1bef8cdd5c..440607ecd362 100644 --- a/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/navigation/ComponentMessagingFragment.kt +++ b/common-ui/src/main/java/com/duckduckgo/mobile/android/themepreview/ui/component/navigation/ComponentMessagingFragment.kt @@ -21,6 +21,6 @@ import com.duckduckgo.mobile.android.themepreview.ui.component.ComponentFragment class ComponentMessagingFragment : ComponentFragment() { override fun getComponents(): List { - return listOf(Component.INFO_PANEL, Component.SNACKBAR) + return listOf(Component.REMOTE_MESSAGE, Component.INFO_PANEL, Component.SNACKBAR) } } diff --git a/common-ui/src/main/res/drawable/background_message_cta.xml b/common-ui/src/main/res/drawable/background_message_cta.xml index 6e58aec07bce..cd93eed9ceac 100644 --- a/common-ui/src/main/res/drawable/background_message_cta.xml +++ b/common-ui/src/main/res/drawable/background_message_cta.xml @@ -15,6 +15,6 @@ --> - - + + \ No newline at end of file diff --git a/common-ui/src/main/res/layout/component_remote_message.xml b/common-ui/src/main/res/layout/component_remote_message.xml new file mode 100644 index 000000000000..605d54e577dc --- /dev/null +++ b/common-ui/src/main/res/layout/component_remote_message.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common-ui/src/main/res/layout/view_message_cta.xml b/common-ui/src/main/res/layout/view_message_cta.xml index 2fe245fed071..bfaca9587997 100644 --- a/common-ui/src/main/res/layout/view_message_cta.xml +++ b/common-ui/src/main/res/layout/view_message_cta.xml @@ -22,12 +22,11 @@ android:id="@+id/close" android:layout_width="@dimen/messageCtaCloseButtonSize" android:layout_height="@dimen/messageCtaCloseButtonSize" - android:padding="@dimen/keyline_2" android:background="?selectableItemBackground" + android:padding="@dimen/keyline_2" android:src="@drawable/ic_close_24" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:tint="?normalTextColor" /> + app:layout_constraintTop_toTopOf="parent" /> - - - - \ No newline at end of file diff --git a/common-ui/src/main/res/values/styles.xml b/common-ui/src/main/res/values/styles.xml index 99c2a5a42521..258b6c87654a 100644 --- a/common-ui/src/main/res/values/styles.xml +++ b/common-ui/src/main/res/values/styles.xml @@ -439,16 +439,6 @@ - - -