<commit_before>package com.app.swe443.openbankapp;


import android.content.Intent;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.NfcEvent;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import static android.content.ContentValues.TAG;


public class AccountDetails extends AppCompatActivity implements AccountFrag.OnAccountFragCallbackListener ,TransferFrag.OnTransferFragCallbackListener, NfcAdapter.OnNdefPushCompleteCallback,
        NfcAdapter.CreateNdefMessageCallback, TransactionFrag.OnTransactionFragCallbackListener{


    //Variables to initalize tabs menu
    ViewPager viewerPager;
    FragmentPageAdapter fragmentPagerAdapter;
    private Toolbar toolbar;
    public ActionBar actionBar;

    //Fields of the account selected

    private NfcAdapter mNfcAdapter;
    private String mNfcAccount;
    private String accountnum;
    private String balance;
    private String type;
    private String username;
    private String userID;

    private ArrayList<String> messagesReceivedArray = new ArrayList<>();
    private ArrayList<String> messagesToSendArray = new ArrayList<>();

    public void addMessage(View view) {
        Toast.makeText(this, "Added Message", Toast.LENGTH_LONG).show();
    }

    private String name;
    private String email;
    private String phone;

    private void updateTextViews() {

        if(fragmentPagerAdapter.account2_fragment != null) {

            ((EditText)fragmentPagerAdapter.account2_fragment.getView().findViewById(R.id.accountnumToAccountInput)).setText("");

            if (messagesReceivedArray.size() > 0) {
//                for (int i = 0; i < messagesReceivedArray.size(); i++) {
                ((EditText)fragmentPagerAdapter.account2_fragment.getView().findViewById(R.id.accountnumToAccountInput)).setText(messagesReceivedArray.get(messagesReceivedArray.size()-1));
//                }
            }
        }else
            Toast.makeText(this, "FAIL", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_accounts);

        //Get accountIndex from MainActivity
        System.out.println("Viewing account fragment for account: "+accountnum);

        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

         /*
            Get the account that these fragments will use
         */
        Bundle extras = getIntent().getExtras();

        type = extras.getString("type");
        balance = extras.getString("balance");<commit_msg>Fixed null pointer in AccoutDetails<commit_after>package com.app.swe443.openbankapp;


import android.content.Intent;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.NfcEvent;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import static android.content.ContentValues.TAG;


public class AccountDetails extends AppCompatActivity implements AccountFrag.OnAccountFragCallbackListener ,TransferFrag.OnTransferFragCallbackListener, NfcAdapter.OnNdefPushCompleteCallback,
        NfcAdapter.CreateNdefMessageCallback, TransactionFrag.OnTransactionFragCallbackListener{


    //Variables to initalize tabs menu
    ViewPager viewerPager;
    FragmentPageAdapter fragmentPagerAdapter;
    private Toolbar toolbar;
    public ActionBar actionBar;

    //Fields of the account selected

    private NfcAdapter mNfcAdapter;
    private String mNfcAccount;
    private String accountnum;
    private String balance;
    private String type;
    private String username;
    private String userID;

    private ArrayList<String> messagesReceivedArray = new ArrayList<>();
    private ArrayList<String> messagesToSendArray = new ArrayList<>();

    public void addMessage(View view) {
        Toast.makeText(this, "Added Message", Toast.LENGTH_LONG).show();
    }

    private String name;
    private String email;
    private String phone;

    private void updateTextViews() {

        if(fragmentPagerAdapter.account2_fragment != null) {

            if((fragmentPagerAdapter.account2_fragment.getView().findViewById(R.id.accountnumToAccountInput)) != null)
                ((EditText)fragmentPagerAdapter.account2_fragment.getView().findViewById(R.id.accountnumToAccountInput)).setText("");

            if (messagesReceivedArray.size() > 0) {
                if((fragmentPagerAdapter.account2_fragment.getView().findViewById(R.id.accountnumToAccountInput)) != null)
                    ((EditText)fragmentPagerAdapter.account2_fragment.getView().findViewById(R.id.accountnumToAccountInput)).setText(messagesReceivedArray.get(messagesReceivedArray.size()-1));
            }
        }else
            Toast.makeText(this, "FAIL", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_accounts);

        //Get accountIndex from MainActivity
        System.out.println("Viewing account fragment for account: "+accountnum);

        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

         /*
            Get the account that these fragments will use
         */
        Bundle extras = getIntent().getExtras();

        type = extras.getString("type");
        balance = extras.getString("balance");
{'fraction_non_alphanumeric': 0.09477966101694915, 'fraction_numerical': 0.003932203389830509, 'mean_word_length': 4.111573111573112, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 13, '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': '1377416', 'n_tokens_mistral': 2087, 'n_tokens_neox': 2003, 'n_words': 416}