<commit_before>package com.jojo.flippy.profile;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;

import com.jojo.flippy.app.R;
import com.jojo.flippy.core.CommunityCenterActivity;
import com.jojo.flippy.util.ToastMessages;
import com.koushikdutta.ion.Ion;

import java.util.ArrayList;
import java.util.List;

public class EditProfileActivity extends ActionBarActivity {
    private ImageView imageViewMemberEdit;
    private EditText editTextEditProfileFirstName;
    private EditText editTextEditProfileLastName;
    private EditText editTextEditProfileEmail;
    private EditText editTextEditProfileDateOfBirth;
    private EditText editTextEditProfileNumber;
    private Spinner genderSpinner;


    private String NewFirstNameUpdate;
    private String NewLastNameUpdate;
    private String NewNumberUpdate;
    private String NewEmailUpdate;
    private String NewDateOfBirthUpdate;
    private String NewGenderUpdate;
    private String NewAvatarUpdate;


    private static final int SELECT_PICTURE = 1;
    private String selectedImagePath;
    private String imagePath;
    private String fileManagerString;
    private int column_index;
    private Cursor cursor;
    private String path;

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


        imageViewMemberEdit =  (ImageView)findViewById(R.id.imageViewMemberEdit);
        editTextEditProfileFirstName =(EditText)findViewById(R.id.editTextEditProfileFirstName);
        editTextEditProfileLastName= (EditText)findViewById(R.id.editTextEditProfileLastName);
        editTextEditProfileEmail= (EditText)findViewById(R.id.editTextEditProfileEmail);
        editTextEditProfileDateOfBirth= (EditText)findViewById(R.id.editTextEditProfileDateOfBirth);
        editTextEditProfileNumber= (EditText)findViewById(R.id.editTextEditProfileNumber);
        genderSpinner= (Spinner)findViewById(R.id.genderSpinner);


        Ion.with(imageViewMemberEdit)
                .placeholder(R.color.flippy_orange)
                .animateIn(R.anim.fade_in)
                .load(CommunityCenterActivity.userAvatarURL);
        editTextEditProfileFirstName.setText(CommunityCenterActivity.userFirstName);
        editTextEditProfileLastName.setText(CommunityCenterActivity.userLastName);
        editTextEditProfileEmail.setText(CommunityCenterActivity.regUserEmail);
        editTextEditProfileDateOfBirth.setText(CommunityCenterActivity.userDateOfBirth);

        if(CommunityCenterActivity.userGender.isEmpty()){
            genderSpinner.setSelection(0);
        }
        if(CommunityCenterActivity.userGender.equalsIgnoreCase("male")){
            genderSpinner.setSelection(1);
        }
        if(CommunityCenterActivity.userGender.equalsIgnoreCase("female")){
            genderSpinner.setSelection(2);
        }


        imageViewMemberEdit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent,
                        "Select Picture"), SELECT_PICTURE);
            }
        });

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK) {
            if (requestCode == SELECT_PICTURE) {
                Uri selectedImageUri = data.getData();
                fileManagerString = selectedImageUri.getPath();
                selectedImagePath = getPath(selectedImageUri);
                // img.setImageURI(selectedImageUri);
                imagePath.getBytes();
                path = imagePath.toString();
                Bitmap bm = BitmapFactory.decodeFile(imagePath);
                imageViewMemberEdit.setImageBitmap(bm);

            }else{<commit_msg>caught exception in EditProfileActivity caused by UserGender check<commit_after>package com.jojo.flippy.profile;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;

import com.jojo.flippy.app.R;
import com.jojo.flippy.core.CommunityCenterActivity;
import com.jojo.flippy.util.ToastMessages;
import com.koushikdutta.ion.Ion;

import java.util.ArrayList;
import java.util.List;

public class EditProfileActivity extends ActionBarActivity {
    private ImageView imageViewMemberEdit;
    private EditText editTextEditProfileFirstName;
    private EditText editTextEditProfileLastName;
    private EditText editTextEditProfileEmail;
    private EditText editTextEditProfileDateOfBirth;
    private EditText editTextEditProfileNumber;
    private Spinner genderSpinner;


    private String NewFirstNameUpdate;
    private String NewLastNameUpdate;
    private String NewNumberUpdate;
    private String NewEmailUpdate;
    private String NewDateOfBirthUpdate;
    private String NewGenderUpdate;
    private String NewAvatarUpdate;


    private static final int SELECT_PICTURE = 1;
    private String selectedImagePath;
    private String imagePath;
    private String fileManagerString;
    private int column_index;
    private Cursor cursor;
    private String path;

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


        imageViewMemberEdit =  (ImageView)findViewById(R.id.imageViewMemberEdit);
        editTextEditProfileFirstName =(EditText)findViewById(R.id.editTextEditProfileFirstName);
        editTextEditProfileLastName= (EditText)findViewById(R.id.editTextEditProfileLastName);
        editTextEditProfileEmail= (EditText)findViewById(R.id.editTextEditProfileEmail);
        editTextEditProfileDateOfBirth= (EditText)findViewById(R.id.editTextEditProfileDateOfBirth);
        editTextEditProfileNumber= (EditText)findViewById(R.id.editTextEditProfileNumber);
        genderSpinner= (Spinner)findViewById(R.id.genderSpinner);


        Ion.with(imageViewMemberEdit)
                .placeholder(R.color.flippy_orange)
                .animateIn(R.anim.fade_in)
                .load(CommunityCenterActivity.userAvatarURL);
        editTextEditProfileFirstName.setText(CommunityCenterActivity.userFirstName);
        editTextEditProfileLastName.setText(CommunityCenterActivity.userLastName);
        editTextEditProfileEmail.setText(CommunityCenterActivity.regUserEmail);
        editTextEditProfileDateOfBirth.setText(CommunityCenterActivity.userDateOfBirth);

        try {
            if(CommunityCenterActivity.userGender.isEmpty()){
                genderSpinner.setSelection(0);
            }
            if(CommunityCenterActivity.userGender.equalsIgnoreCase("male")){
                genderSpinner.setSelection(1);
            }
            if(CommunityCenterActivity.userGender.equalsIgnoreCase("female")){
                genderSpinner.setSelection(2);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


        imageViewMemberEdit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent,
                        "Select Picture"), SELECT_PICTURE);
            }
        });

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK) {
            if (requestCode == SELECT_PICTURE) {
                Uri selectedImageUri = data.getData();
                fileManagerString = selectedImageUri.getPath();
                selectedImagePath = getPath(selectedImageUri);
                // img.setImageURI(selectedImageUri);
                imagePath.getBytes();
                path = imagePath.toString();
                Bitmap bm = BitmapFactory.decodeFile(imagePath);
                imageViewMemberEdit.setImageBitmap(bm);

            }else{
{'fraction_non_alphanumeric': 0.07804347826086956, 'fraction_numerical': 0.0010869565217391304, 'mean_word_length': 3.356534090909091, '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': '7393573', 'n_tokens_mistral': 2490, 'n_tokens_neox': 2343, 'n_words': 415}