<commit_before>/*
 * Copyright (C) 2015 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hookedonplay.decoviewsample;

import android.graphics.Color;
import android.graphics.PointF;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.TextView;

import com.hookedonplay.decoviewlib.DecoView;
import com.hookedonplay.decoviewlib.charts.ChartSeries;
import com.hookedonplay.decoviewlib.charts.SeriesItem;
import com.hookedonplay.decoviewlib.events.DecoEvent;

public class SamplePauseFragment extends SampleFragment {
    private int mSeries1Index;
    private int mPieIndex;

    public SamplePauseFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_sample_pause, container, false);
    }

    @Override
    protected void createTracks() {
        final DecoView decoView = getDecoView();
        final View view = getView();
        if (decoView == null || view == null) {
            return;
        }
        view.setBackgroundColor(Color.argb(255, 64, 96, 214));

        decoView.executeReset();
        decoView.deleteAll();

        final float seriesMax = 100f;

        float circleInset = getDimension(18);
        SeriesItem seriesBack1Item = new SeriesItem.Builder(Color.parseColor("#11000000"))
                .setRange(0, seriesMax, 0)
                .setChartStyle(SeriesItem.ChartStyle.STYLE_PIE)
                .setInset(new PointF(circleInset, circleInset))
                .build();

        mPieIndex = decoView.addSeries(seriesBack1Item);

        SeriesItem series1Item = new SeriesItem.Builder(COLOR_YELLOW)
                .setRange(0, seriesMax, 0)
                .setLineWidth(getDimension(36))
                .setInterpolator(new LinearInterpolator())
                .build();

        series1Item.addArcSeriesItemListener(new SeriesItem.SeriesItemListener() {
            @Override
            public void onSeriesItemAnimationProgress(float percentComplete, float currentPosition) {
                decoView.getChartSeries(mPieIndex).setPosition(percentComplete < 1.0f ? percentComplete * seriesMax : 0f);
            }

            @Override
            public void onSeriesItemDisplayProgress(float percentComplete) {

            }
        });

        mSeries1Index = decoView.addSeries(series1Item);

        final TextView textPause = (TextView) view.findViewById(R.id.textViewPause);
        final DecoEvent.ExecuteEventListener eventListener = new DecoEvent.ExecuteEventListener() {
            @Override<commit_msg>Update SamplePauseFragment to add shadow<commit_after>/*
 * Copyright (C) 2015 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hookedonplay.decoviewsample;

import android.graphics.Color;
import android.graphics.PointF;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.TextView;

import com.hookedonplay.decoviewlib.DecoView;
import com.hookedonplay.decoviewlib.charts.ChartSeries;
import com.hookedonplay.decoviewlib.charts.SeriesItem;
import com.hookedonplay.decoviewlib.events.DecoEvent;

public class SamplePauseFragment extends SampleFragment {
    private int mSeries1Index;
    private int mPieIndex;

    public SamplePauseFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_sample_pause, container, false);
    }

    @Override
    protected void createTracks() {
        final DecoView decoView = getDecoView();
        final View view = getView();
        if (decoView == null || view == null) {
            return;
        }
        view.setBackgroundColor(Color.argb(255, 64, 96, 214));

        decoView.executeReset();
        decoView.deleteAll();

        // Important: As we are going to use shadows on this DecoView, we must disable hardware
        // acceleration or the shadow will not render.
        decoView.disableHardwareAccelerationForDecoView();

        final float seriesMax = 100f;

        float circleInset = getDimension(18);
        SeriesItem seriesBack1Item = new SeriesItem.Builder(Color.parseColor("#11000000"))
                .setRange(0, seriesMax, 0)
                .setChartStyle(SeriesItem.ChartStyle.STYLE_PIE)
                .setInset(new PointF(circleInset, circleInset))
                .build();

        mPieIndex = decoView.addSeries(seriesBack1Item);

        // Note: As we are placing a shadow on this view we are insetting it by the amount of the
        // shadow. This is because otherwise at the center of the top and side edge the shadow
        // will render outside the bounds of the view.
        SeriesItem series1Item = new SeriesItem.Builder(Color.parseColor("#FFFFC107"))
                .setRange(0, seriesMax, 0)
                .setLineWidth(getDimension(36))
                .setInset(new PointF(getDimension(8f), getDimension(8f)))
                .setShadowSize(getDimension(8f))
                .setShadowColor(Color.BLACK)
                .setInterpolator(new LinearInterpolator())
                .build();

        series1Item.addArcSeriesItemListener(new SeriesItem.SeriesItemListener() {
            @Override
            public void onSeriesItemAnimationProgress(float percentComplete, float currentPosition) {
                decoView.getChartSeries(mPieIndex).setPosition(percentComplete < 1.0f ? percentComplete * seriesMax : 0f);
            }

            @Override
            public void onSeriesItemDisplayProgress(float percentComplete) {

            }
        });

        mSeries1Index = decoView.addSeries(series1Item);

        final TextView textPause = (TextView) view.findViewById(R.id.textViewPause);
        final DecoEvent.ExecuteEventListener eventListener = new DecoEvent.ExecuteEventListener() {
            @Override
{'fraction_non_alphanumeric': 0.08211504303866649, 'fraction_numerical': 0.013663068725235688, 'mean_word_length': 2.9165329052969504, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3438496', 'n_tokens_mistral': 2053, 'n_tokens_neox': 1917, 'n_words': 524}