<commit_before>package com.manuelpeinado.fadingactionbar;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.ScrollView;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.cyrilmottier.android.translucentactionbar.NotifyingScrollView;

public class FadingActionBar {

    public static class Initializer {
        private Drawable mActionBarBackgroundDrawable;
        private FrameLayout mHeaderContainer;
        private int mActionBarBackgroundResId;
        private int mHeaderLayoutResId;
        private View mHeaderView;
        private int mContentLayoutResId;
        private View mContentView;
        private ActionBar mActionBar;
        private LayoutInflater mInflater;
        private boolean mLightActionBar;

        public Initializer actionBarBackground(int drawableResId) {
            mActionBarBackgroundResId = drawableResId;
            return this;
        }

        public Initializer actionBarBackground(Drawable drawable) {
            mActionBarBackgroundDrawable = drawable;
            return this;
        }

        public Initializer headerLayout(int layoutResId) {
            mHeaderLayoutResId = layoutResId;
            return this;
        }

        public Initializer headerView(View view) {
            mHeaderView = view;
            return this;
        }

        public Initializer contentLayout(int layoutResId) {
            mContentLayoutResId = layoutResId;
            return this;
        }

        public Initializer contentView(View view) {
            mContentView = view;
            return this;
        }

        public void apply(SherlockActivity activity) {
            //
            // Prepare everything

            parseAttrs(activity);

            mInflater = LayoutInflater.from(activity);
            mActionBar = activity.getSupportActionBar();
            if (mActionBarBackgroundDrawable == null) {
                mActionBarBackgroundDrawable = activity.getResources().getDrawable(mActionBarBackgroundResId);
            }
            mActionBar.setBackgroundDrawable(mActionBarBackgroundDrawable);
            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
                mActionBarBackgroundDrawable.setCallback(mDrawableCallback);
            }
            mActionBarBackgroundDrawable.setAlpha(0);

            LayoutInflater inflater = LayoutInflater.from(activity);
            if (mContentView == null) {
                mContentView = inflater.inflate(mContentLayoutResId, null);
            }
            if (mHeaderView == null) {
                mHeaderView = inflater.inflate(mHeaderLayoutResId, mHeaderContainer, false);
            }

            //
            // See if we are in a ListView or ScrollView scenario

            ListView listView = (ListView) activity.findViewById(android.R.id.list);
            if (listView != null) {
                applyListView(activity, listView);
            } else {
                applyScrollView(activity);
            }
        }

        private void parseAttrs(Context context) {
            // Get defaults
            boolean lightActionBarDefault = context.getResources().getBoolean(R.bool.fab__default_light_action_bar);

            // Extract theme attributes
            TypedArray ta = context.obtainStyledAttributes(null, R.styleable.FadingActionBar, R.attr.fadingActionBarStyle,<commit_msg>fixed bug in list view support<commit_after>package com.manuelpeinado.fadingactionbar;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.ScrollView;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.cyrilmottier.android.translucentactionbar.NotifyingScrollView;

public class FadingActionBar {

    public static class Initializer {
        private Drawable mActionBarBackgroundDrawable;
        private FrameLayout mHeaderContainer;
        private int mActionBarBackgroundResId;
        private int mHeaderLayoutResId;
        private View mHeaderView;
        private int mContentLayoutResId;
        private View mContentView;
        private ActionBar mActionBar;
        private LayoutInflater mInflater;
        private boolean mLightActionBar;

        public Initializer actionBarBackground(int drawableResId) {
            mActionBarBackgroundResId = drawableResId;
            return this;
        }

        public Initializer actionBarBackground(Drawable drawable) {
            mActionBarBackgroundDrawable = drawable;
            return this;
        }

        public Initializer headerLayout(int layoutResId) {
            mHeaderLayoutResId = layoutResId;
            return this;
        }

        public Initializer headerView(View view) {
            mHeaderView = view;
            return this;
        }

        public Initializer contentLayout(int layoutResId) {
            mContentLayoutResId = layoutResId;
            return this;
        }

        public Initializer contentView(View view) {
            mContentView = view;
            return this;
        }

        public void apply(SherlockActivity activity) {
            //
            // Prepare everything

            parseAttrs(activity);

            mInflater = LayoutInflater.from(activity);
            mActionBar = activity.getSupportActionBar();
            if (mActionBarBackgroundDrawable == null) {
                mActionBarBackgroundDrawable = activity.getResources().getDrawable(mActionBarBackgroundResId);
            }
            mActionBar.setBackgroundDrawable(mActionBarBackgroundDrawable);
            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
                mActionBarBackgroundDrawable.setCallback(mDrawableCallback);
            }
            mActionBarBackgroundDrawable.setAlpha(0);

            LayoutInflater inflater = LayoutInflater.from(activity);
            if (mContentView == null) {
                mContentView = inflater.inflate(mContentLayoutResId, null);
            }
            if (mHeaderView == null) {
                mHeaderView = inflater.inflate(mHeaderLayoutResId, mHeaderContainer, false);
            }

            //
            // See if we are in a ListView or ScrollView scenario

            ListView listView = (ListView) mContentView.findViewById(android.R.id.list);
            if (listView != null) {
                applyListView(activity, listView);
            } else {
                applyScrollView(activity);
            }
        }

        private void parseAttrs(Context context) {
            // Get defaults
            boolean lightActionBarDefault = context.getResources().getBoolean(R.bool.fab__default_light_action_bar);

            // Extract theme attributes
            TypedArray ta = context.obtainStyledAttributes(null, R.styleable.FadingActionBar, R.attr.fadingActionBarStyle,
{'fraction_non_alphanumeric': 0.06745139531807962, 'fraction_numerical': 0.00026451527575717496, 'mean_word_length': 2.4310344827586206, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1693980', 'n_tokens_mistral': 1930, 'n_tokens_neox': 1857, 'n_words': 390}