package com.bernard.mcqinator.view.activities.fragenActivities;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.bernard.mcqinator.R;
import com.bernard.mcqinator.api.frageable.TextFrageable;
import com.bernard.mcqinator.api.fragen.TextFrage;

public class TextFrageActivity extends FrageActivity<TextFrage> implements View.OnClickListener{

    TextView frage;
    EditText antwort;
    Button nextButton;

    @Override
    public void initiate(TextFrage f) {
        frage.setText(f.getFrage());
    }

    @Override
    @SuppressWarnings("null")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_frage);

        TextFrageable.TextData data = getIntent().getParcelableExtra(QUIZ_DATA);

        frage= findViewById(R.id.frageText);
        antwort = findViewById(R.id.antwortText);
        nextButton = findViewById(R.id.next);

        nextButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        TextFrage.Reply reply = new TextFrage.Reply(antwort.getText().toString());

        reply(reply);
    }
}
