<commit_before>package com.reactnativenavigation.views;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.MotionEvent;
import android.view.View;

import com.reactnativenavigation.params.NavigationParams;
import com.reactnativenavigation.views.collapsingToolbar.CollapseAmount;
import com.reactnativenavigation.views.collapsingToolbar.CollapsingView;
import com.reactnativenavigation.views.collapsingToolbar.OnScrollViewAddedListener;
import com.reactnativenavigation.views.collapsingToolbar.ScrollListener;
import com.reactnativenavigation.views.collapsingToolbar.ScrollViewDelegate;
import com.reactnativenavigation.views.collapsingToolbar.ViewCollapser;
import com.reactnativenavigation.views.utils.ScrollViewDetector;

public class CollapsingContentView extends ContentView implements CollapsingView {

    private @Nullable ScrollViewDelegate scrollViewDelegate;
    private @Nullable ScrollViewDetector scrollViewDetector;
    private final ViewCollapser viewCollapser;

    public CollapsingContentView(Context context, String screenId, NavigationParams navigationParams) {
        super(context, screenId, navigationParams);
        viewCollapser = new ViewCollapser(this);
    }

    public void setupCollapseDetection(ScrollListener scrollListener, OnScrollViewAddedListener onScrollViewAddedListener) {
        scrollViewDelegate = new ScrollViewDelegate(scrollListener);
        scrollViewDetector = new ScrollViewDetector(this, onScrollViewAddedListener, scrollViewDelegate);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (scrollViewDelegate != null) {
            boolean consumed = scrollViewDelegate.didInterceptTouchEvent(ev);
            if (consumed) {<commit_msg>Intercept touch event only if ScrollView exists (#475)<commit_after>package com.reactnativenavigation.views;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.MotionEvent;
import android.view.View;

import com.reactnativenavigation.params.NavigationParams;
import com.reactnativenavigation.views.collapsingToolbar.CollapseAmount;
import com.reactnativenavigation.views.collapsingToolbar.CollapsingView;
import com.reactnativenavigation.views.collapsingToolbar.OnScrollViewAddedListener;
import com.reactnativenavigation.views.collapsingToolbar.ScrollListener;
import com.reactnativenavigation.views.collapsingToolbar.ScrollViewDelegate;
import com.reactnativenavigation.views.collapsingToolbar.ViewCollapser;
import com.reactnativenavigation.views.utils.ScrollViewDetector;

public class CollapsingContentView extends ContentView implements CollapsingView {

    private @Nullable ScrollViewDelegate scrollViewDelegate;
    private @Nullable ScrollViewDetector scrollViewDetector;
    private final ViewCollapser viewCollapser;

    public CollapsingContentView(Context context, String screenId, NavigationParams navigationParams) {
        super(context, screenId, navigationParams);
        viewCollapser = new ViewCollapser(this);
    }

    public void setupCollapseDetection(ScrollListener scrollListener, OnScrollViewAddedListener onScrollViewAddedListener) {
        scrollViewDelegate = new ScrollViewDelegate(scrollListener);
        scrollViewDetector = new ScrollViewDetector(this, onScrollViewAddedListener, scrollViewDelegate);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (scrollViewDelegate != null && scrollViewDelegate.hasScrollView()) {
            boolean consumed = scrollViewDelegate.didInterceptTouchEvent(ev);
            if (consumed) {
{'fraction_non_alphanumeric': 0.06351836509251588, 'fraction_numerical': 0.0008285004142502071, 'mean_word_length': 6.172277227722772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3527086', 'n_tokens_mistral': 946, 'n_tokens_neox': 910, 'n_words': 178}