<commit_before>package com.actionbarsherlock.internal.widget;

import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;

/**
 * A simple extension of a regular linear layout that supports the divider API
 * of Android 4.0+.
 */
public class IcsLinearLayout extends NineLinearLayout {
    private static final int[] LinearLayout = new int[] {
        /* 0 */ android.R.attr.divider,
        /* 1 */ android.R.attr.showDividers,
        /* 2 */ android.R.attr.dividerPadding,
    };
    private static final int LinearLayout_divider = 0;
    private static final int LinearLayout_showDividers = 1;
    private static final int LinearLayout_dividerPadding = 2;

    /**
     * Don't show any dividers.
     */
    public static final int SHOW_DIVIDER_NONE = 0;
    /**
     * Show a divider at the beginning of the group.
     */
    public static final int SHOW_DIVIDER_BEGINNING = 1;
    /**
     * Show dividers between each item in the group.
     */
    public static final int SHOW_DIVIDER_MIDDLE = 2;
    /**
     * Show a divider at the end of the group.
     */
    public static final int SHOW_DIVIDER_END = 4;


    private Drawable mDivider;
    private int mDividerWidth;
    private int mShowDividers;
    private int mDividerPadding;


    public IcsLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

        TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/LinearLayout);

        setDividerDrawable(a.getDrawable(/*com.android.internal.R.styleable.*/LinearLayout_divider));
        mShowDividers = a.getInt(/*com.android.internal.R.styleable.*/LinearLayout_showDividers, SHOW_DIVIDER_NONE);
        mDividerPadding = a.getDimensionPixelSize(/*com.android.internal.R.styleable.*/LinearLayout_dividerPadding, 0);

        a.recycle();
    }

    /**
     * Set a drawable to be used as a divider between items.
     * @param divider Drawable that will divide each item.
     * @see #setShowDividers(int)
     */
    public void setDividerDrawable(Drawable divider) {
        if (divider == mDivider) {
            return;
        }
        mDivider = divider;
        if (divider != null) {
            mDividerWidth = divider.getIntrinsicWidth();
        } else {
            mDividerWidth = 0;
        }
        setWillNotDraw(divider == null);
        requestLayout();
    }

    /**
     * Get the width of the current divider drawable.
     *
     * @hide Used internally by framework.
     */
    public int getDividerWidth() {
        return mDividerWidth;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if (mDivider != null) {
            final int count = getChildCount();
            final int halfDividerWidth = mDividerWidth / 2;
            for (int i = 0; i < count; i++) {
                final View child = getChildAt(i);
                if (child != null && child.getVisibility() != GONE) {
                    if (hasDividerBeforeChildAt(i)) {
                        final LayoutParams lp = (LayoutParams) child.getLayoutParams();
                        final int left = child.getLeft() - lp.leftMargin - halfDividerWidth;
                        drawVerticalDivider(canvas, left);
                    }
                }
            }
    
            if (hasDividerBeforeChildAt(count)) {
                final View child = getChildAt(count - 1);
                int right = 0;
                if (child == null) {
                    right = getWidth() - getPaddingRight() - mDividerWidth;
                } else {<commit_msg>Appease the checkstyle overlords.<commit_after>package com.actionbarsherlock.internal.widget;

import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;

/**
 * A simple extension of a regular linear layout that supports the divider API
 * of Android 4.0+.
 */
public class IcsLinearLayout extends NineLinearLayout {
    private static final int[] LinearLayout = new int[] {
        /* 0 */ android.R.attr.divider,
        /* 1 */ android.R.attr.showDividers,
        /* 2 */ android.R.attr.dividerPadding,
    };
    private static final int LinearLayout_divider = 0;
    private static final int LinearLayout_showDividers = 1;
    private static final int LinearLayout_dividerPadding = 2;

    /**
     * Don't show any dividers.
     */
    public static final int SHOW_DIVIDER_NONE = 0;
    /**
     * Show a divider at the beginning of the group.
     */
    public static final int SHOW_DIVIDER_BEGINNING = 1;
    /**
     * Show dividers between each item in the group.
     */
    public static final int SHOW_DIVIDER_MIDDLE = 2;
    /**
     * Show a divider at the end of the group.
     */
    public static final int SHOW_DIVIDER_END = 4;


    private Drawable mDivider;
    private int mDividerWidth;
    private int mShowDividers;
    private int mDividerPadding;


    public IcsLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

        TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/LinearLayout);

        setDividerDrawable(a.getDrawable(/*com.android.internal.R.styleable.*/LinearLayout_divider));
        mShowDividers = a.getInt(/*com.android.internal.R.styleable.*/LinearLayout_showDividers, SHOW_DIVIDER_NONE);
        mDividerPadding = a.getDimensionPixelSize(/*com.android.internal.R.styleable.*/LinearLayout_dividerPadding, 0);

        a.recycle();
    }

    /**
     * Set a drawable to be used as a divider between items.
     * @param divider Drawable that will divide each item.
     * @see #setShowDividers(int)
     */
    public void setDividerDrawable(Drawable divider) {
        if (divider == mDivider) {
            return;
        }
        mDivider = divider;
        if (divider != null) {
            mDividerWidth = divider.getIntrinsicWidth();
        } else {
            mDividerWidth = 0;
        }
        setWillNotDraw(divider == null);
        requestLayout();
    }

    /**
     * Get the width of the current divider drawable.
     *
     * @hide Used internally by framework.
     */
    public int getDividerWidth() {
        return mDividerWidth;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if (mDivider != null) {
            final int count = getChildCount();
            final int halfDividerWidth = mDividerWidth / 2;
            for (int i = 0; i < count; i++) {
                final View child = getChildAt(i);
                if (child != null && child.getVisibility() != GONE) {
                    if (hasDividerBeforeChildAt(i)) {
                        final LayoutParams lp = (LayoutParams) child.getLayoutParams();
                        final int left = child.getLeft() - lp.leftMargin - halfDividerWidth;
                        drawVerticalDivider(canvas, left);
                    }
                }
            }

            if (hasDividerBeforeChildAt(count)) {
                final View child = getChildAt(count - 1);
                int right = 0;
                if (child == null) {
                    right = getWidth() - getPaddingRight() - mDividerWidth;
                } else {
{'fraction_non_alphanumeric': 0.09444151738672286, 'fraction_numerical': 0.004741833508956797, 'mean_word_length': 2.213288192975032, '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': '7591144', 'n_tokens_mistral': 2226, 'n_tokens_neox': 2124, 'n_words': 561}