<commit_before>package com.shortsands.audioplayer;

/**
 * Created by garygriswold on 8/30/17.
 */
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.Gravity;
import android.view.MotionEvent;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

class AudioBibleView {

    private static final String TAG = "AudioBibleView";

    private static AudioBibleView instance = null;
    static AudioBibleView shared(AudioBibleController controller, AudioBible audioBible) {
        if (AudioBibleView.instance == null) {
            AudioBibleView.instance = new AudioBibleView(controller, audioBible);
        }
        return AudioBibleView.instance;
    }

    private final AudioBibleController controller;
    private final Activity activity;
    private final AudioBible audioBible;
    private final ViewGroup webview;
    private final RelativeLayout audioPanel;
    private final int panelHeight;
    private final RelativeLayout.LayoutParams playParams;
    private final RelativeLayout.LayoutParams pauseParams;
    private final ImageButton playButton;
    private final ImageButton pauseButton;
    private final ImageButton stopButton;
    private final SeekBar scrubSlider;
    private final ImageView verseButton;
    private final TextView verseLabel;
    // Precomputed for positionVersePopup
    private Float sliderRange;
    private Float sliderOrigin;
    private Float sliderOriginActual;
    // Transient State Variables
    private MonitorSeekBar monitorSeekBar = null;
    private boolean scrubSliderDrag = false;
    private int verseNum = 0;
    private boolean isAudioViewActive = false;

    private AudioBibleView(AudioBibleController controller, AudioBible audioBible) {
        this.controller = controller;
        this.activity = controller.activity;
        this.audioBible = audioBible;

        Window window = this.activity.getWindow();
        this.webview = (ViewGroup)window.getDecorView();
        //this.webview.setBackgroundColor(0x440000FF); // for debug only

        DisplayMetrics metrics = new DisplayMetrics();
        this.activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
        Log.d(TAG, "metrics=" + metrics.toString());

        // Compute Dimensions: buttons 3/8 inches,
        int btnDiameter = Math.round(metrics.densityDpi * 3.1f / 8.0f);
        int btnRadius = btnDiameter / 2;
        this.panelHeight = (int)(btnDiameter * 3.0);
        int buttonTop = panelHeight - (int)(btnDiameter * 1.2);
        int scrubSliderTop = buttonTop - (int)(btnDiameter * 1.05);

        RelativeLayout layout = new RelativeLayout(this.activity);
        layout.setBackgroundColor(0xFFFFFFFF);<commit_msg>Round the corners of the Audio Panel.<commit_after>package com.shortsands.audioplayer;

/**
 * Created by garygriswold on 8/30/17.
 */
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.shapes.RoundRectShape;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.Gravity;
import android.view.MotionEvent;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

class AudioBibleView {

    private static final String TAG = "AudioBibleView";

    private static AudioBibleView instance = null;
    static AudioBibleView shared(AudioBibleController controller, AudioBible audioBible) {
        if (AudioBibleView.instance == null) {
            AudioBibleView.instance = new AudioBibleView(controller, audioBible);
        }
        return AudioBibleView.instance;
    }

    private final AudioBibleController controller;
    private final Activity activity;
    private final AudioBible audioBible;
    private final ViewGroup webview;
    private final RelativeLayout audioPanel;
    private final int panelHeight;
    private final RelativeLayout.LayoutParams playParams;
    private final RelativeLayout.LayoutParams pauseParams;
    private final ImageButton playButton;
    private final ImageButton pauseButton;
    private final ImageButton stopButton;
    private final SeekBar scrubSlider;
    private final ImageView verseButton;
    private final TextView verseLabel;
    // Precomputed for positionVersePopup
    private Float sliderRange;
    private Float sliderOrigin;
    private Float sliderOriginActual;
    // Transient State Variables
    private MonitorSeekBar monitorSeekBar = null;
    private boolean scrubSliderDrag = false;
    private int verseNum = 0;
    private boolean isAudioViewActive = false;

    private AudioBibleView(AudioBibleController controller, AudioBible audioBible) {
        this.controller = controller;
        this.activity = controller.activity;
        this.audioBible = audioBible;

        Window window = this.activity.getWindow();
        this.webview = (ViewGroup)window.getDecorView();
        //this.webview.setBackgroundColor(0x440000FF); // for debug only

        DisplayMetrics metrics = new DisplayMetrics();
        this.activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
        Log.d(TAG, "metrics=" + metrics.toString());

        // Compute Dimensions: buttons 3/8 inches,
        int btnDiameter = Math.round(metrics.densityDpi * 3.1f / 8.0f);
        int btnRadius = btnDiameter / 2;
        this.panelHeight = (int)(btnDiameter * 3.0);
        int buttonTop = panelHeight - (int)(btnDiameter * 1.2);
        int scrubSliderTop = buttonTop - (int)(btnDiameter * 1.05);

        float radius = btnDiameter / 3.0f;
        float[] radii = new float[] { radius, radius, radius, radius, radius, radius, radius, radius };
        RoundRectShape roundRect = new RoundRectShape(radii, null, null);
        ShapeDrawable background = new ShapeDrawable(roundRect);
        background.getPaint().setColor(0xFFFFFFFF);

        RelativeLayout layout = new RelativeLayout(this.activity);
        layout.setBackground(background);
{'fraction_non_alphanumeric': 0.08140733107610776, 'fraction_numerical': 0.008538201089356691, 'mean_word_length': 3.825284090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '5456812', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1789, 'n_words': 482}