<commit_before>package de.danoeh.antennapod.core.util.playback;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.ShownotesProvider;

/**
 * Connects chapter information and shownotes of a shownotesProvider, for example by making it possible to use the
 * shownotes to navigate to another position in the podcast or by highlighting certain parts of the shownotesProvider's
 * shownotes.
 * <p/>
 * A timeline object needs a shownotesProvider from which the chapter information is retrieved and shownotes are generated.
 */
public class Timeline {
    private static final String TAG = "Timeline";

    private static final String WEBVIEW_STYLE = "@font-face { font-family: 'Roboto-Light'; src: url('file:///android_asset/Roboto-Light.ttf'); } * { color: %s; font-family: roboto-Light; font-size: 13pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; } a.timecode { color: #669900; } img { display: block; margin: 10 auto; max-width: %s; height: auto; } body { margin: %dpx %dpx %dpx %dpx; }";


    private ShownotesProvider shownotesProvider;

    private final String noShownotesLabel;
    private final String colorPrimaryString;
    private final String colorSecondaryString;
    private final int pageMargin;

    public Timeline(Context context, ShownotesProvider shownotesProvider) {
        if (shownotesProvider == null) {
            throw new IllegalArgumentException("shownotesProvider = null");
        }
        this.shownotesProvider = shownotesProvider;

        noShownotesLabel = context.getString(R.string.no_shownotes_label);

        TypedArray res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
        @ColorInt int col = res.getColor(0, 0);
        colorPrimaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
                Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
        res.recycle();
        res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary});
        col = res.getColor(0, 0);
        colorSecondaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
                Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
        res.recycle();

        pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
                context.getResources().getDisplayMetrics()
        );<commit_msg>Reformatted css for readability<commit_after>package de.danoeh.antennapod.core.util.playback;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.ShownotesProvider;

/**
 * Connects chapter information and shownotes of a shownotesProvider, for example by making it possible to use the
 * shownotes to navigate to another position in the podcast or by highlighting certain parts of the shownotesProvider's
 * shownotes.
 * <p/>
 * A timeline object needs a shownotesProvider from which the chapter information is retrieved and shownotes are generated.
 */
public class Timeline {
    private static final String TAG = "Timeline";

    private static final String WEBVIEW_STYLE =
            "@font-face {"
            + "font-family: 'Roboto-Light';"
            + "src: url('file:///android_asset/Roboto-Light.ttf');"
            + "}"
            + "* {"
            + "color: %s;"
            + "font-family: roboto-Light;"
            + "font-size: 13pt;"
            + "}"
            + "a {"
            + "font-style: normal;"
            + "text-decoration: none;"
            + "font-weight: normal;"
            + "color: #00A8DF;"
            + "}"
            + "a.timecode {"
            + "color: #669900;"
            + "}"
            + "img {"
            + "display: block;"
            + "margin: 10 auto;"
            + "max-width: %s;"
            + "height: auto;"
            + "}"
            + "body {"
            + "margin: %dpx %dpx %dpx %dpx;"
            + "}";


    private ShownotesProvider shownotesProvider;

    private final String noShownotesLabel;
    private final String colorPrimaryString;
    private final String colorSecondaryString;
    private final int pageMargin;

    public Timeline(Context context, ShownotesProvider shownotesProvider) {
        if (shownotesProvider == null) {
            throw new IllegalArgumentException("shownotesProvider = null");
        }
        this.shownotesProvider = shownotesProvider;

        noShownotesLabel = context.getString(R.string.no_shownotes_label);

        TypedArray res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
        @ColorInt int col = res.getColor(0, 0);
        colorPrimaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
                Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
        res.recycle();
        res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary});
        col = res.getColor(0, 0);
        colorSecondaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
                Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
        res.recycle();

        pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
                context.getResources().getDisplayMetrics()
        );
{'fraction_non_alphanumeric': 0.12460864120225423, 'fraction_numerical': 0.008140262993112084, 'mean_word_length': 3.0487959442332064, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3142047', 'n_tokens_mistral': 1950, 'n_tokens_neox': 1878, 'n_words': 433}