<commit_before>package com.pinomg.determinator.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.pinomg.determinator.model.Poll;
import com.pinomg.determinator.R;
import com.pinomg.determinator.helpers.Session;
import com.pinomg.determinator.net.ApiErrorException;
import com.pinomg.determinator.net.ApiHandler;


public class AnswerPollActivity extends Activity {

    private Poll poll;
    private TextView questionText;
    private Button btnAltOne, btnAltTwo;
    private Session session;

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

        session = new Session(getApplicationContext());

        questionText = (TextView) findViewById(R.id.question_text);
        btnAltOne = (Button) findViewById(R.id.btn_alt_one);
        btnAltTwo = (Button) findViewById(R.id.btn_alt_two);

        Bundle extras = getIntent().getExtras();
        if(extras != null) {
            poll = (Poll) extras.getSerializable("POLL");
            questionText.setText(poll.getQuestion());
            btnAltOne.setText(poll.getAlternativeOne());
            btnAltTwo.setText(poll.getAlternativeTwo());

        } else {
            Toast.makeText(getBaseContext(), "Error in loading question!", Toast.LENGTH_LONG).show();
        }
    }


    public void answerQuestion(int answer) {
        ApiHandler apiHandler = new ApiHandler(getBaseContext());<commit_msg>Cleaned AnswerPollActivity and added description<commit_after>package com.pinomg.determinator.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.pinomg.determinator.model.Poll;
import com.pinomg.determinator.R;
import com.pinomg.determinator.helpers.Session;
import com.pinomg.determinator.net.ApiErrorException;
import com.pinomg.determinator.net.ApiHandler;

/**
 * The activity that is used when answering a Poll.
 * This activity gets the serialized poll from MainActivity,
 * and when the answer is sent to the api the activity finishes.
 */

public class AnswerPollActivity extends Activity {

    private Poll poll;
    private Session session;

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

        session = new Session(getApplicationContext());

        TextView questionText = (TextView) findViewById(R.id.question_text);
        Button btnAltOne = (Button) findViewById(R.id.btn_alt_one);
        Button btnAltTwo = (Button) findViewById(R.id.btn_alt_two);

        Bundle extras = getIntent().getExtras();
        if(extras != null) {
            poll = (Poll) extras.getSerializable("POLL");
            questionText.setText(poll.getQuestion());
            btnAltOne.setText(poll.getAlternativeOne());
            btnAltTwo.setText(poll.getAlternativeTwo());

        } else {
            Toast.makeText(getBaseContext(), "Error in loading question!", Toast.LENGTH_LONG).show();
        }
    }


    public void answerQuestion(int answer) {
        ApiHandler apiHandler = new ApiHandler(getBaseContext());
{'fraction_non_alphanumeric': 0.1007357102433503, 'fraction_numerical': 0.0, 'mean_word_length': 3.7322623828647923, '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': '6891384', 'n_tokens_mistral': 1019, 'n_tokens_neox': 967, 'n_words': 210}