<commit_before>package groovey.didactic.disco.org.didacticdisco.fragments;

import android.app.Fragment;
import android.os.Bundle;
import android.os.StrictMode;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import groovey.didactic.disco.org.didacticdisco.DiscoApplication;
import groovey.didactic.disco.org.didacticdisco.R;
import groovey.didactic.disco.org.didacticdisco.data.Session;

public class SignInFragment extends Fragment implements TextView.OnEditorActionListener
{
    @BindView(R.id.username) TextView username;
    @Inject                  Session  session;

    public static SignInFragment getInstance()
    {
        return new SignInFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        ((DiscoApplication) getActivity().getApplicationContext()).getAppComponent().inject(this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        StrictMode.allowThreadDiskWrites(); //TODO: StrictMode gone after dev!
        StrictMode.allowThreadDiskReads();

        View view = inflater.inflate(R.layout.fragment_sign_in, container, false);
        ButterKnife.bind(this, view);
        username.setOnEditorActionListener(this);

        return view;
    }

    @OnClick(R.id.action_start)
    void onClick()
    {
        verifyUsername();
    }

    @Override
    public boolean onEditorAction(TextView textView, int actionID, KeyEvent key)
    {
        // Reset errors.
        username.setError(null);

        if (actionID == R.id.login || actionID == EditorInfo.IME_NULL)
        {
            verifyUsername();
            return true;
        }

        return false;
    }

    private void verifyUsername()
    {
        if (TextUtils.isEmpty(username.getText()))
        {// Check for a valid username.
            username.setError(getString(R.string.error_field_required));
            username.requestFocus();
        } else
        {
            session.set(R.string.key_username, username.getText().toString());
        }
    }
}<commit_msg>Wip: Changing fragment<commit_after>package groovey.didactic.disco.org.didacticdisco.fragments;

import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.os.StrictMode;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import groovey.didactic.disco.org.didacticdisco.DiscoApplication;
import groovey.didactic.disco.org.didacticdisco.R;
import groovey.didactic.disco.org.didacticdisco.data.Session;

public class SignInFragment extends Fragment implements TextView.OnEditorActionListener
{
    @BindView(R.id.username) TextView username;
    @Inject                  Session  session;

    public static SignInFragment getInstance()
    {
        return new SignInFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        ((DiscoApplication) getActivity().getApplicationContext()).getAppComponent().inject(this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        StrictMode.allowThreadDiskWrites(); //TODO: StrictMode gone after dev!
        StrictMode.allowThreadDiskReads();

        View view = inflater.inflate(R.layout.fragment_sign_in, container, false);
        ButterKnife.bind(this, view);
        username.setOnEditorActionListener(this);

        return view;
    }

    @OnClick(R.id.action_start)
    void onClick()
    {
        verifyUsername();
    }

    @Override
    public boolean onEditorAction(TextView textView, int actionID, KeyEvent key)
    {
        // Reset errors.
        username.setError(null);

        if (actionID == R.id.login || actionID == EditorInfo.IME_NULL)
        {
            verifyUsername();
            return true;
        }

        return false;
    }

    private void verifyUsername()
    {
        if (TextUtils.isEmpty(username.getText()))
        {// Check for a valid username.
            username.setError(getString(R.string.error_field_required));
            username.requestFocus();
        } else
        {
            session.set(R.string.key_username, username.getText().toString());
            //            getActivity().startService(); // TODO: Start location service

            FragmentTransaction transaction = getFragmentManager().beginTransaction();
            transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
            transaction.replace(R.id.content_frame, GameFragment.getInstance());
            transaction.commit();
        }
    }
}
{'fraction_non_alphanumeric': 0.09729831853391271, 'fraction_numerical': 0.0, 'mean_word_length': 3.0691775557263643, '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': '4049121', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1436, 'n_words': 278}