Skip to content

Commit

Permalink
Scrolable InApp CB screen in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
adam1929 authored Sep 25, 2024
1 parent c23e117 commit 96fdfd1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.exponea.example.view.fragments

import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.res.Resources
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
Expand Down Expand Up @@ -126,6 +127,10 @@ class InAppContentBlocksFragment : BaseFragment() {

private fun prepareExampleListCbPlaceholder() {
content_blocks_list?.layoutManager = LinearLayoutManager(requireContext())
content_blocks_list?.layoutParams?.apply {
height = Resources.getSystem().getDisplayMetrics().heightPixels / 2
}
content_blocks_list?.layoutParams = content_blocks_list?.layoutParams
val data = ArrayList<ProductsViewModel>()
for (i in 1..1000) {
val icon = listOf(
Expand Down
143 changes: 75 additions & 68 deletions app/src/main/res/layout/fragment_inapp_content_blocks.xml
Original file line number Diff line number Diff line change
@@ -1,86 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".view.MainActivity"
android:padding="12dp">
tools:context=".view.MainActivity">

<TextView
android:id="@+id/content_blocks_carousel_title_1"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="@string/content_blocks_default_carousel_title"/>
android:padding="12dp">

<com.exponea.sdk.view.ContentBlockCarouselView
android:id="@+id/content_blocks_carousel_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_title_1"
app:placeholderId="example_carousel"
/>
<TextView
android:id="@+id/content_blocks_carousel_title_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="@string/content_blocks_default_carousel_title"/>

<TextView
android:id="@+id/content_blocks_carousel_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_default"/>
<com.exponea.sdk.view.ContentBlockCarouselView
android:id="@+id/content_blocks_carousel_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_title_1"
app:placeholderId="example_carousel"
/>

<TextView
android:id="@+id/content_blocks_carousel_title_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_status"
android:text="@string/content_blocks_custom_carousel_title"/>
<TextView
android:id="@+id/content_blocks_carousel_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_default"/>

<com.exponea.sdk.view.ContentBlockCarouselView
android:id="@+id/content_blocks_carousel_custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_title_2"
app:placeholderId="example_carousel"
app:scrollDelay="10"
app:maxMessagesCount="5"
/>
<TextView
android:id="@+id/content_blocks_carousel_title_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_status"
android:text="@string/content_blocks_custom_carousel_title"/>

<TextView
android:id="@+id/content_blocks_carousel_title_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_custom"
android:text="@string/content_blocks_android_carousel_title"/>
<com.exponea.sdk.view.ContentBlockCarouselView
android:id="@+id/content_blocks_carousel_custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_title_2"
app:placeholderId="example_carousel"
app:scrollDelay="10"
app:maxMessagesCount="5"
/>

<com.exponea.sdk.view.ContentBlockCarouselView
android:id="@+id/content_blocks_carousel_android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_title_3"
app:placeholderId="example_carousel_and"
/>
<TextView
android:id="@+id/content_blocks_carousel_title_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_custom"
android:text="@string/content_blocks_android_carousel_title"/>

<LinearLayout
android:id="@+id/content_blocks_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_android"
android:orientation="vertical"
>
<com.exponea.sdk.view.ContentBlockCarouselView
android:id="@+id/content_blocks_carousel_android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_title_3"
app:placeholderId="example_carousel_and"
/>

</LinearLayout>
<LinearLayout
android:id="@+id/content_blocks_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/content_blocks_carousel_android"
android:orientation="vertical"
>

<TextView
android:id="@+id/content_blocks_products_title"
android:layout_below="@+id/content_blocks_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/content_blocks_messages_list"/>
</LinearLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/content_blocks_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/content_blocks_products_title"
/>
</RelativeLayout>
<TextView
android:id="@+id/content_blocks_products_title"
android:layout_below="@+id/content_blocks_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/content_blocks_messages_list"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/content_blocks_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@+id/content_blocks_products_title"
/>

</RelativeLayout>

</ScrollView>

0 comments on commit 96fdfd1

Please sign in to comment.