<commit_before>package net.nitroshare.android;

import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;

import net.nitroshare.android.discovery.DiscoveryService;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Ensure we have write access to external storage
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            int permission = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
            if (permission != PackageManager.PERMISSION_GRANTED) {
                String[] permissions = {
                        Manifest.permission.WRITE_EXTERNAL_STORAGE,
                };
                requestPermissions(permissions, 0);
            }
        }

        // TODO: error handling!

        // Start the discovery service
        Intent startIntent = new Intent(this, DiscoveryService.class);
        startIntent.setAction(DiscoveryService.ACTION_START);
        startService(startIntent);
    }
}
<commit_msg>Trigger intro on first launch.<commit_after>package net.nitroshare.android;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;

public class MainActivity extends Activity {

    public static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        SharedPreferences sharedPreferences =
                PreferenceManager.getDefaultSharedPreferences(getBaseContext());

        // Launch the intro if the user hasn't seen it yet
        boolean introShown = sharedPreferences.getBoolean(
                getString(R.string.setting_first_start), false);

        if (!introShown) {
            Log.d(TAG, "intro has not been shown; launching activity");

            Intent introIntent = new Intent(this, MainIntroActivity.class);
            startActivity(introIntent);

            // Remember that the intro has been seen
            sharedPreferences.edit().putBoolean(
                    getString(R.string.setting_first_start), true).apply();
        }

        // Start the discovery service
        Intent startIntent = new Intent(this, DiscoveryService.class);
        startIntent.setAction(DiscoveryService.ACTION_START);
        startService(startIntent);
    }
}

{'fraction_non_alphanumeric': 0.08207581891792418, 'fraction_numerical': 0.000368052999631947, 'mean_word_length': 2.8939828080229226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6958109', 'n_tokens_mistral': 695, 'n_tokens_neox': 661, 'n_words': 155}