Исправь ошибки : FATAL EXCEPTION: main
                                                                                                    Process: com.example.cinema_provider_app, PID: 29259
                                                                                                    java.lang.NullPointerException: view.findViewById(R.id.motionLayout) must not be null
                                                                                                    	at com.example.cinema_provider_app.main_Fragments.Home_Fragment.HomeFragment.onViewCreated(HomeFragment.kt:199)
                                                                                                    	at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987)
                                                                                                    	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546)
                                                                                                    	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
                                                                                                    	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
                                                                                                    	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
                                                                                                    	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
                                                                                                    	at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3138)
                                                                                                    	at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3072)
                                                                                                    	at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
                                                                                                    	at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:502)
                                                                                                    	at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
                                                                                                    	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1582)
                                                                                                    	at android.app.Activity.performStart(Activity.java:8628)
                                                                                                    	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3807)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:225)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8176)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
---------------------------- PROCESS ENDED (29259) for package com.example.cinema_provider_app ----------------------------
2023-08-09 23:18:20.029  2029-4934  OpenGLRenderer          com...d.googlequicksearchbox:search  E  Unable to match the desired swap behavior.
2023-08-09 23:18:20.035  1222-2436  OpenGLRenderer          com...le.android.apps.nexuslauncher  E  Unable to match the desired swap behavior.
2023-08-09 23:18:22.844   684-1921  TaskPersister           system_server                        E  File error accessing recents directory (directory doesn't exist?). package com.example.cinema_provider_app.main_Fragments.Home_Fragment

import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewConfiguration
import android.view.ViewGroup
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.core.view.MotionEventCompat
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SnapHelper
import com.example.cinema_provider_app.R
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Adapters.CustomRecycleAdapter
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Adapters.FirstTypeAdapter
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Adapters.SliderAdapter
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Data_Classes.CustomDataClass
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Data_Classes.FirstDataType
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Data_Classes.SlideItem


class HomeFragment : Fragment() {


    private val scrollHandler = Handler()
    private lateinit var scrollRunnable: Runnable
    private lateinit var sliderRecyclerView: RecyclerView

    private lateinit var firstTypeRecyclerView: RecyclerView
    private lateinit var secondTypeRecyclerView: RecyclerView
    private lateinit var customRecyclerView: RecyclerView


    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.fragment_home, container, false)


        return view
    }

    @SuppressLint("ClickableViewAccessibility")
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //FIRST SLIDER ON THE TOP
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        sliderRecyclerView = view.findViewById(R.id.sliderRecyclerView)
        sliderRecyclerView.layoutManager =
            LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)

        val snapHelper: SnapHelper = PagerSnapHelper()
        snapHelper.attachToRecyclerView(sliderRecyclerView)

        val slideItems = listOf(
            SlideItem(" Slide 1", "Description 1", R.drawable._54282_admin),
            SlideItem(" Slide 2", "Description 2", R.drawable._54282_admin),
            SlideItem(" Slide 3", "Description 3", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 4", "Description 4", R.drawable._54282_admin),
            SlideItem(" Slide 5", "Description 5", R.drawable._54282_admin)
        )
        val sliderAdapter = SliderAdapter(slideItems)
        sliderRecyclerView.adapter = sliderAdapter
        scrollRunnable = Runnable {
            val layoutManager = sliderRecyclerView.layoutManager as LinearLayoutManager
            val currentPosition = layoutManager.findFirstVisibleItemPosition()
            val nextPosition =
                if (currentPosition < sliderAdapter.itemCount - 1) currentPosition + 1 else 0
            sliderRecyclerView.smoothScrollToPosition(nextPosition)
            scrollHandler.postDelayed(scrollRunnable, AUTO_SCROLL_DELAY)
        }

        scrollHandler.postDelayed(scrollRunnable, AUTO_SCROLL_DELAY)
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //SECOND TYPE SLIDER's
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        firstTypeRecyclerView = view.findViewById(R.id.first_type_recycleView)
        val secondSlideItem = listOf<FirstDataType>(
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin)
        )
        firstTypeRecyclerView.layoutManager =
            LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
        val firstTypeAdapter = FirstTypeAdapter(secondSlideItem)
        firstTypeRecyclerView.adapter = firstTypeAdapter
        val snappHelper: SnapHelper = LinearSnapHelper()
        snappHelper.attachToRecyclerView(firstTypeRecyclerView)




        secondTypeRecyclerView = view.findViewById(R.id.first_type_recycleView_2)
        val secondTypeSlideItem = listOf<FirstDataType>(
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin),
            FirstDataType(R.drawable._54282_admin)
        )
        secondTypeRecyclerView.layoutManager =
            LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
        val secondTypeAdapter = FirstTypeAdapter(secondTypeSlideItem)
        secondTypeRecyclerView.adapter = secondTypeAdapter
        val snappHelperr: SnapHelper = LinearSnapHelper()
        snappHelperr.attachToRecyclerView(secondTypeRecyclerView)

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //CUSTOM TYPE SLIDER's
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        customRecyclerView = view.findViewById(R.id.CustomRecycleView)
        customRecyclerView.layoutManager =
            LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
        val customList = listOf(
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            ),
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            ),
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            ),
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            ),
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            ),
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            ),
            CustomDataClass(
                R.drawable._54282_admin,
                R.drawable._54282_admin,
                R.drawable._54282_admin
            )
        )
        val customAdapter = CustomRecycleAdapter(customList)
        customRecyclerView.adapter = customAdapter
        val customSnapHelper: SnapHelper = PagerSnapHelper()
        customSnapHelper.attachToRecyclerView(customRecyclerView)


        var motionLayout: MotionLayout
        var rightCard: View
        var leftCard: View

        var startX = 0f
        var startY = 0f

        motionLayout = view.findViewById(R.id.motionLayout)
        rightCard = view.findViewById(R.id.rightCard)
        leftCard = view.findViewById(R.id.leftCard)

        motionLayout.setTransitionListener(object : MotionLayout.TransitionListener {
            override fun onTransitionStarted(
                motionLayout: MotionLayout,
                startId: Int,
                endId: Int
            ) {
            }

            override fun onTransitionChange(
                motionLayout: MotionLayout,
                startId: Int,
                endId: Int,
                progress: Float
            ) {
            }

            override fun onTransitionCompleted(motionLayout: MotionLayout, currentId: Int) {
                if (currentId == R.id.rightCard) {
                    rightCard.visibility = View.VISIBLE
                    leftCard.visibility = View.GONE
                } else if (currentId == R.id.leftCard) {
                    rightCard.visibility = View.GONE
                    leftCard.visibility = View.VISIBLE
                }
            }

            override fun onTransitionTrigger(
                motionLayout: MotionLayout,
                triggerId: Int,
                positive: Boolean,
                progress: Float
            ) {
            }
        })

        motionLayout.setOnTouchListener { view, event ->
            val action = MotionEventCompat.getActionMasked(event)

            when (action) {
                MotionEvent.ACTION_DOWN -> {
                    startX = event.x
                    startY = event.y
                }

                MotionEvent.ACTION_MOVE -> {
                    val distanceX = event.x - startX
                    val distanceY = event.y - startY
                    val swipeThreshold = ViewConfiguration.get(requireContext()).scaledTouchSlop

                    if (distanceX > swipeThreshold && Math.abs(distanceX) > Math.abs(distanceY)) {
                        motionLayout.progress = 0f
                        return@setOnTouchListener true
                    } else if (distanceX < -swipeThreshold && Math.abs(distanceX) > Math.abs(
                            distanceY
                        )
                    ) {
                        motionLayout.progress = 1f
                        return@setOnTouchListener true
                    }
                }
            }

            return@setOnTouchListener false
        }
    }


    override fun onDestroy() {
        scrollHandler.removeCallbacks(scrollRunnable)
        super.onDestroy()
    }

    companion object {
        private const val AUTO_SCROLL_DELAY = 10000L // Задержка в миллисекундах (4 секунды)

        @JvmStatic
        fun newInstance() = HomeFragment()
    }
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/motionLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:backgroundTint="@color/transparent"
    app:layoutDescription="@xml/item_custom_type_scene">

    <androidx.cardview.widget.CardView
        android:id="@+id/rightCard"
        android:layout_width="150dp"
        android:layout_height="200dp"
        app:cardElevation="2dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/middleCard"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:rotationY="16">

        <ImageView
            android:id="@+id/right_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:rotationX="0"
            android:scaleType="centerCrop" />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/leftCard"
        android:layout_width="150dp"
        android:layout_height="200dp"
        app:cardElevation="2dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/middleCard"
        app:layout_constraintTop_toTopOf="parent"
        android:rotationY="-16">

        <ImageView
            android:id="@+id/left_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:scaleType="centerCrop" />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/middleCard"
        android:layout_width="150dp"
        android:layout_height="200dp"
        app:cardElevation="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/leftCard"
        app:layout_constraintStart_toEndOf="@+id/rightCard"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/middle_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:scaleType="centerCrop" />
    </androidx.cardview.widget.CardView>

</androidx.constraintlayout.motion.widget.MotionLayout>