<commit_before>package edu.uoregon.casls.aris_android;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import org.apache.http.Header;
import org.apache.http.entity.StringEntity;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import edu.uoregon.casls.aris_android.Utilities.AppConfig;
import edu.uoregon.casls.aris_android.Utilities.AppUtils;
import edu.uoregon.casls.aris_android.Utilities.Calls;


public class ForgotPasswordActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {

	private AutoCompleteTextView mAcTvEmail;
	private View mProgressView;
	private View mResetPasswordFormView;

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

		mAcTvEmail = (AutoCompleteTextView) findViewById(R.id.actv_email_address);
		populateAutoComplete();

		mAcTvEmail.setOnEditorActionListener(new TextView.OnEditorActionListener() {
			@Override
			public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
				if (actionId == EditorInfo.IME_ACTION_DONE) {
					attemptToSubmitForm();
					return true;
				}
				return false;
			}
		});

		mResetPasswordFormView = findViewById(R.id.scrollvw_for_pw_reset_form);
		mProgressView = findViewById(R.id.network_req_progress);
	}

	private void populateAutoComplete() {
		getLoaderManager().initLoader(0, null, this);
	}


	private void pollServer() {
		RequestParams rqParams = new RequestParams();

		final Context context = this;
		String request_url = AppConfig.SERVER_URL_MOBILE + Calls.HTTP_USER_REQ_FORGOT_PASSWD;<commit_msg>Fix forgot pw crashing if contacts perm not granted<commit_after>package edu.uoregon.casls.aris_android;

import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import org.apache.http.Header;
import org.apache.http.entity.StringEntity;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import edu.uoregon.casls.aris_android.Utilities.AppConfig;
import edu.uoregon.casls.aris_android.Utilities.AppUtils;
import edu.uoregon.casls.aris_android.Utilities.Calls;

import static android.content.pm.PackageManager.PERMISSION_GRANTED;


public class ForgotPasswordActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {

	private AutoCompleteTextView mAcTvEmail;
	private View mProgressView;
	private View mResetPasswordFormView;

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

		mAcTvEmail = (AutoCompleteTextView) findViewById(R.id.actv_email_address);
		populateAutoComplete();

		mAcTvEmail.setOnEditorActionListener(new TextView.OnEditorActionListener() {
			@Override
			public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
				if (actionId == EditorInfo.IME_ACTION_DONE) {
					attemptToSubmitForm();
					return true;
				}
				return false;
			}
		});

		mResetPasswordFormView = findViewById(R.id.scrollvw_for_pw_reset_form);
		mProgressView = findViewById(R.id.network_req_progress);
	}

	private void populateAutoComplete() {
		if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) == PERMISSION_GRANTED) {
			getLoaderManager().initLoader(0, null, this);
		}
	}


	private void pollServer() {
		RequestParams rqParams = new RequestParams();

		final Context context = this;
		String request_url = AppConfig.SERVER_URL_MOBILE + Calls.HTTP_USER_REQ_FORGOT_PASSWD;
{'fraction_non_alphanumeric': 0.08886509635974305, 'fraction_numerical': 0.0008922198429693076, 'mean_word_length': 6.365308804204993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1466281', 'n_tokens_mistral': 1767, 'n_tokens_neox': 1663, 'n_words': 312}