<commit_before>package com.iktwo.musicgear;

import android.app.DownloadManager;
import android.app.DownloadManager.Request;
import android.content.Context;
import android.content.Intent;
import android.os.Environment;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;

import com.iktwo.musicgear.R;

public class MusicGear extends org.qtproject.qt5.android.bindings.QtActivity
{
    private static final String TAG = "MusicGear";
    private static DownloadManager dm;
    private static MusicGear m_instance;

    public MusicGear()
    {
        m_instance = this;
    }

    @Override
    protected void onStart()
    {
        super.onStart();
        m_instance = this;
    }

    public static void download(String url, String name)
    {
        Log.v(TAG, "download(" + url + ", " + name + ")");

        dm = (DownloadManager) m_instance.getSystemService(DOWNLOAD_SERVICE);
        Request request = new Request(Uri.parse(url));
        request.setTitle(name);
        request.setDescription(url);
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MUSIC, name + ".mp3");
        dm.enqueue(request);
    }

    public static void share(String name, String url)
    {
        Intent share = new Intent(android.content.Intent.ACTION_SEND);
        share.setType("text/plain");<commit_msg>Initial phone call detection<commit_after>package com.iktwo.musicgear;

import android.app.DownloadManager;
import android.app.DownloadManager.Request;
import android.content.Context;
import android.content.Intent;
import android.os.Environment;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;

import com.iktwo.musicgear.R;

public class MusicGear extends org.qtproject.qt5.android.bindings.QtActivity
{
    private static final String TAG = "MusicGear";
    private static DownloadManager dm;
    private static MusicGear m_instance;
    private boolean isPausedByCall = false;

    private PhoneStateListener phoneStateListener;
    private TelephonyManager telephonyManager;

    public MusicGear()
    {
        m_instance = this;
    }

    @Override
    protected void onStart()
    {
        super.onStart();
        m_instance = this;

        /*
        telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
                phoneStateListener = new PhoneStateListener() {
                    @Override
                    public void onCallStateChanged(int state, String incomingNumber) {
                        // String stateString = "N/A";
                        Log.v(TAG, "Starting CallStateChange");
                        switch (state) {
                            case TelephonyManager.CALL_STATE_OFFHOOK:
                            case TelephonyManager.CALL_STATE_RINGING:
                                if (m_mediaPlayer != null) {
                                    pauseMedia();
                                    isPausedByCall = true;
                                }

                                break;
                            case TelephonyManager.CALL_STATE_IDLE:
                                // Phone idle. Start playing.
                                if (m_mediaPlayer != null) {
                                    if (isPausedByCall) {
                                        isPausedByCall = false;
                                        playMedia();
                                    }

                                }
                                break;
                        }

                    }
                };

                telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
        */
    }

    @Override
    public void onDestroy() {
        if (phoneStateListener != null) {
            telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
        }
    }


    public static void download(String url, String name)
    {
        Log.v(TAG, "download(" + url + ", " + name + ")");

        dm = (DownloadManager) m_instance.getSystemService(DOWNLOAD_SERVICE);
        Request request = new Request(Uri.parse(url));
        request.setTitle(name);
        request.setDescription(url);
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MUSIC, name + ".mp3");
        dm.enqueue(request);
    }

    public static void share(String name, String url)
    {
        Intent share = new Intent(android.content.Intent.ACTION_SEND);
        share.setType("text/plain");
{'fraction_non_alphanumeric': 0.08450417430258603, 'fraction_numerical': 0.0008144980655670943, 'mean_word_length': 2.0339715873996296, 'pattern_counts': {'":': 0, '<': 3, '<?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': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '244899', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1240, 'n_words': 252}