<commit_before>package com.pr0gramm.app.viewer;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import android.widget.VideoView;

import com.pr0gramm.app.R;

import roboguice.inject.InjectView;

/**
 * Plays videos in a not optimal but compatible way.
 */
@SuppressLint("ViewConstructor")
public class SimpleVideoViewerFragment extends ViewerFragment {
    private boolean playing;

    @InjectView(R.id.video)
    private VideoView videoView;

    public SimpleVideoViewerFragment(Context context, Binder binder, String url) {
        super(context, binder, R.layout.player_video_compat, url);

        videoView.setOnPreparedListener(mp -> {
            mp.setLooping(true);
            mp.setVolume(0, 0);

            // scale view correctly
            float aspect = mp.getVideoWidth() / (float) mp.getVideoHeight();
            resizeViewerView(videoView, aspect, 10);

            hideBusyIndicator();
        });

        Log.i(TAG, "Playing webm " + url);
        videoView.setVideoURI(Uri.parse(url));
    }

    @Override
    public void onResume() {
        super.onResume();

        // continue playing
        if (playing)
            videoView.start();
    }

    @Override
    public void playMedia() {
        super.playMedia();
        Log.i(TAG, "Setting state to 'playing' now.");
        playing = true;

        if (videoView != null)
            videoView.start();
    }

    @Override
    public void stopMedia() {
        super.stopMedia();
        playing = false;

        if (videoView != null)
            videoView.pause();
    }
}<commit_msg>Pausiere Videos in onPause<commit_after>package com.pr0gramm.app.viewer;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import android.widget.VideoView;

import com.pr0gramm.app.R;

import roboguice.inject.InjectView;

/**
 * Plays videos in a not optimal but compatible way.
 */
@SuppressLint("ViewConstructor")
public class SimpleVideoViewerFragment extends ViewerFragment {
    private boolean playing;

    @InjectView(R.id.video)
    private VideoView videoView;

    public SimpleVideoViewerFragment(Context context, Binder binder, String url) {
        super(context, binder, R.layout.player_video_compat, url);

        videoView.setOnPreparedListener(mp -> {
            mp.setLooping(true);
            mp.setVolume(0, 0);

            // scale view correctly
            float aspect = mp.getVideoWidth() / (float) mp.getVideoHeight();
            resizeViewerView(videoView, aspect, 10);

            hideBusyIndicator();
        });

        Log.i(TAG, "Playing webm " + url);
        videoView.setVideoURI(Uri.parse(url));
    }

    @Override
    public void onResume() {
        super.onResume();

        // continue playing
        if (playing)
            videoView.start();
    }

    @Override
    public void onPause() {
        videoView.pause();
        super.onPause();
    }

    @Override
    public void playMedia() {
        super.playMedia();
        Log.i(TAG, "Setting state to 'playing' now.");
        playing = true;

        if (videoView != null)
            videoView.start();
    }

    @Override
    public void stopMedia() {
        super.stopMedia();
        playing = false;

        if (videoView != null)
            videoView.pause();
    }
}
{'fraction_non_alphanumeric': 0.11049237983587339, 'fraction_numerical': 0.0035169988276670576, 'mean_word_length': 2.3892750744786495, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6037131', 'n_tokens_mistral': 1018, 'n_tokens_neox': 981, 'n_words': 225}