title: ConcatAdapter how to change scroll position of inner RecyclerView that is located in an Adapter from another Adapter?
body: <p><a href="https://i.stack.imgur.com/NJBmP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NJBmP.jpg" alt="enter image description here" /></a></p>
  <p>In the image section with Favorites and the horizontal RecyclerView is one adapter, <strong>adapterFavoriteProperties</strong>,  while the row
  with chart is another adapter, <strong>adapterChart</strong>, of the main RecyclerView. Main RecyclerView is composed of rows that coming each from different adapter that is glued with Concat Adapter.</p>
  <pre><code>val concatAdapter =
          ConcatAdapter(
              adapterFavoriteProperties,
              adapterChart,
              adapterMostViewedProperties,
              adapterRecommendedProperties
          )
  </code></pre>
  <p>Also adapter for chart has a lambda available in the fragment</p>
  <pre><code>    val chartItemClickLambda: ((Float) -&gt; Unit) = { position -&gt;
          println(&quot; DashboardFragment chart CLICK $position&quot;)
  
      }
  
      val adapterChart =
          ChartContainerAdapter(chartItemClickLambda)
  </code></pre>
  <p>The section that contains title, see All and recyclerView is</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
  
      &lt;data&gt;
  
          &lt;variable
              name=&quot;propertyListModel&quot;
              type=&quot;com.smarttoolfactory.dashboard.model.PropertyItemListModel&quot; /&gt;
      &lt;/data&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          visibilityBasedOn=&quot;@{!propertyListModel.items.isEmpty()}&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
  
  
          &lt;com.google.android.material.textview.MaterialTextView
              android:id=&quot;@+id/tvTitle&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginStart=&quot;16dp&quot;
              android:layout_marginTop=&quot;12dp&quot;
              android:layout_marginBottom=&quot;8dp&quot;
              android:text=&quot;@{propertyListModel.title}&quot;
              android:textSize=&quot;20sp&quot;
              android:textStyle=&quot;bold&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              tools:text=&quot;Title&quot; /&gt;
  
          &lt;com.google.android.material.textview.MaterialTextView
              android:id=&quot;@+id/tvSeeAll&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginEnd=&quot;16dp&quot;
              visibilityBasedOn=&quot;@{propertyListModel.seeAll}&quot;
              android:text=&quot;See all&quot;
              android:textColor=&quot;#FB8C00&quot;
              android:textStyle=&quot;bold&quot;
              app:layout_constraintBottom_toBottomOf=&quot;@id/tvTitle&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              tools:text=&quot;See all&quot; /&gt;
  
  
          &lt;androidx.recyclerview.widget.RecyclerView
              android:id=&quot;@+id/recyclerView&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:paddingStart=&quot;8dp&quot;
              android:paddingEnd=&quot;8dp&quot;
              app:items=&quot;@{propertyListModel.items}&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toBottomOf=&quot;@id/tvTitle&quot; /&gt;
  
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
  &lt;/layout&gt;
  </code></pre>
  <p>And it's adapter</p>
  <pre><code>class HorizontalListWithTitleAdapter(
      private val onItemClick: ((PropertyItem) -&gt; Unit)? = null
  ) :
      ListAdapter&lt;PropertyItemListModel, HorizontalItemViewHolder&gt;(
          DefaultItemDiffCallback()
      ) {
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HorizontalItemViewHolder {
  
          return HorizontalItemViewHolder(
              DataBindingUtil.inflate(
                  LayoutInflater.from(parent.context),
                  R.layout.layout_list_with_title,
                  parent, false
              ),
              onItemClick
          )
      }
  
      override fun onBindViewHolder(holder: HorizontalItemViewHolder, position: Int) {
          holder.bindTo(currentList[position])
      }
  }
  </code></pre>
  <p>and <code>ViewHolder</code></p>
  <pre><code>class HorizontalItemViewHolder(
      private val binding: LayoutListWithTitleBinding,
      private val onItemClick: ((PropertyItem) -&gt; Unit)? = null
  ) :
      RecyclerView.ViewHolder(binding.root) {
  
      fun bindTo(item: PropertyItemListModel) {
  
          binding.setVariable(BR.propertyListModel, item)
  
          binding.recyclerView.apply {
  
              // Set Layout manager
              this.layoutManager =
                  ScaledLinearLayoutManager(this.context, LinearLayoutManager.HORIZONTAL, false)
  
              // Set RecyclerViewAdapter
              val itemListAdapter = PropertyListAdapter(R.layout.item_property_favorite, onItemClick)
  
              this.adapter = itemListAdapter
  
          }
  
          binding.executePendingBindings()
      }
  }
  </code></pre>
  <p>This where i should have either reference of RecyclerView or have ViewHolder to call it's recyclerView's <code>smoothScrollToPosition(position)</code></p>