<commit_before>package com.lloydtorres.stately;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.android.volley.NetworkError;
import com.android.volley.NoConnectionError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.common.base.CharMatcher;
import com.lloydtorres.stately.dto.Nation;

import org.simpleframework.xml.core.Persister;

/**
 * Created by Lloyd on 2016-01-13.
 */
public class LoginActivity extends AppCompatActivity {
    private final String APP_TAG = "com.lloydtorres.stately";
    private static final CharMatcher CHAR_MATCHER = CharMatcher.JAVA_LETTER_OR_DIGIT
                                                                .or(CharMatcher.WHITESPACE)
                                                                .or(CharMatcher.anyOf("-"))
                                                                .precomputed();

    private EditText username;
    private EditText password;
    private Button login;
    private boolean isLoggingIn;

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

        username = (EditText) findViewById(R.id.field_username);
        password = (EditText) findViewById(R.id.field_password);
        login = (Button) findViewById(R.id.login_button);
    }

    public void verifyLogin(View view)
    {
        if (!getLoginState())
        {
            setLoginState(true);
            String name = username.getText().toString();
            boolean verify = CHAR_MATCHER.matchesAllOf(name);
            if (verify && name.length() > 0)
            {
                name = name.toLowerCase().replace(" ","_");
                queryNS(view, name);
            }
            else
            {
                makeSnackbar(view, getString(R.string.login_error_404));
            }
        }
    }

    private void queryNS(View view, String nationName)
    {
        final View fView = view;

        RequestQueue queue = Volley.newRequestQueue(this);
        String targetURL = String.format(Nation.QUERY, nationName);
<commit_msg>Set login state to false if ASCII enforcement fails<commit_after>package com.lloydtorres.stately;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.android.volley.NetworkError;
import com.android.volley.NoConnectionError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.common.base.CharMatcher;
import com.lloydtorres.stately.dto.Nation;

import org.simpleframework.xml.core.Persister;

/**
 * Created by Lloyd on 2016-01-13.
 */
public class LoginActivity extends AppCompatActivity {
    private final String APP_TAG = "com.lloydtorres.stately";
    private static final CharMatcher CHAR_MATCHER = CharMatcher.JAVA_LETTER_OR_DIGIT
                                                                .or(CharMatcher.WHITESPACE)
                                                                .or(CharMatcher.anyOf("-"))
                                                                .precomputed();

    private EditText username;
    private EditText password;
    private Button login;
    private boolean isLoggingIn;

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

        username = (EditText) findViewById(R.id.field_username);
        password = (EditText) findViewById(R.id.field_password);
        login = (Button) findViewById(R.id.login_button);
    }

    public void verifyLogin(View view)
    {
        if (!getLoginState())
        {
            setLoginState(true);
            String name = username.getText().toString();
            boolean verify = CHAR_MATCHER.matchesAllOf(name);
            if (verify && name.length() > 0)
            {
                name = name.toLowerCase().replace(" ","_");
                queryNS(view, name);
            }
            else
            {
                setLoginState(false);
                makeSnackbar(view, getString(R.string.login_error_404));
            }
        }
    }

    private void queryNS(View view, String nationName)
    {
        final View fView = view;

        RequestQueue queue = Volley.newRequestQueue(this);
        String targetURL = String.format(Nation.QUERY, nationName);

{'fraction_non_alphanumeric': 0.09537037037037037, 'fraction_numerical': 0.004814814814814815, 'mean_word_length': 2.405422446406053, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2893123', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1436, 'n_words': 285}