package com.example.l4z.quizapp;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.EditText;

public class MainMenu extends AppCompatActivity {

    private static String userName;
    Button championButton, itemButton, spellsButton;
    EditText editText;



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


        editText = (EditText) findViewById(R.id.edit_text_main);
        userName = editText.getText().toString();

        championButton = (Button) findViewById(R.id.championButton);
        championButton.setOnClickListener(v -> {
            startQuiz((byte) 0);
        });

        itemButton = (Button) findViewById(R.id.itemButton);
        itemButton.setOnClickListener(v -> {
            startQuiz((byte) 1);
        });

        spellsButton = (Button) findViewById(R.id.spellsButton);
        spellsButton.setOnClickListener(v -> {
            startQuiz((byte) 2);
        });
    }

    private void startQuiz(byte b) {
        Intent intent = new Intent(MainMenu.this, MainActivity.class);
        intent.putExtra(MainActivity.PRESSED_BUTTON_KEY, b);
        MainMenu.this.startActivity(intent);
    }

    public static String getUserName() {
        return userName;
    }
}

@@ -133,16 +133,79 @@
 tivity;%0A
+import android.text.Editable;%0Aimport android.text.TextWatcher;%0A
 import a
@@ -226,16 +226,16 @@
 Button;%0A
-
 import a
@@ -423,18 +423,16 @@
 tText;%0A%0A
-%0A%0A
     @Ove
@@ -591,17 +591,24 @@
 _menu);%0A
-%0A
+        
 %0A       
@@ -669,59 +669,8 @@
 n);%0A
-        userName = editText.getText().toString();%0A%0A
     
@@ -1085,32 +1085,32 @@
 Listener(v -%3E %7B%0A
-
             star
@@ -1137,16 +1137,497 @@
      %7D);
+%0A%0A        editText.addTextChangedListener(new TextWatcher() %7B%0A            @Override%0A            public void beforeTextChanged(CharSequence s, int start, int count, int after) %7B%0A%0A            %7D%0A%0A            @Override%0A            public void onTextChanged(CharSequence s, int start, int before, int count) %7B%0A%0A            %7D%0A%0A            @Override%0A            public void afterTextChanged(Editable s) %7B%0A                userName = editText.getText().toString();%0A            %7D%0A        %7D);
 %0A    %7D%0A%0A

add input editText