<commit_before>package com.github.michaelengland.fliptheswitch.app;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;

import com.github.michaelengland.fliptheswitch.Feature;
import com.github.michaelengland.fliptheswitch.FlipTheSwitch;

public class FeaturesActivity extends AppCompatActivity {
    private FlipTheSwitch flipTheSwitch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        flipTheSwitch = new FlipTheSwitch(this);
        setContentView(R.layout.activitiy_features);
    }

    @Override
    protected void onStart() {
        super.onStart();
        getResetButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                flipTheSwitch.resetAllFeatures();
            }
        });

        FeaturesAdapter adapter = new FeaturesAdapter(getLayoutInflater(), FlipTheSwitch.getDefaultFeatures(),
                new FeaturesAdapter.OnFeatureToggledListener() {<commit_msg>Fix bug with features not appearing when feature app loaded before main app<commit_after>package com.github.michaelengland.fliptheswitch.app;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;

import com.github.michaelengland.fliptheswitch.Feature;
import com.github.michaelengland.fliptheswitch.FlipTheSwitch;

public class FeaturesActivity extends AppCompatActivity {
    private FlipTheSwitch flipTheSwitch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try {
            Class.forName("com.github.michaelengland.fliptheswitch.Features");
        } catch (ClassNotFoundException ignored) {
        }
        flipTheSwitch = new FlipTheSwitch(this);
        setContentView(R.layout.activitiy_features);
    }

    @Override
    protected void onStart() {
        super.onStart();
        getResetButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                flipTheSwitch.resetAllFeatures();
            }
        });

        FeaturesAdapter adapter = new FeaturesAdapter(getLayoutInflater(), FlipTheSwitch.getDefaultFeatures(),
                new FeaturesAdapter.OnFeatureToggledListener() {
{'fraction_non_alphanumeric': 0.08286852589641434, 'fraction_numerical': 0.0007968127490039841, 'mean_word_length': 3.4442477876106197, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6207907', 'n_tokens_mistral': 664, 'n_tokens_neox': 655, 'n_words': 125}