package de.jomaway.tichuscorecounter;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

import static android.R.attr.data;
import static de.jomaway.tichuscorecounter.R.id.player1_name;
import static de.jomaway.tichuscorecounter.R.id.player2_name;
import static de.jomaway.tichuscorecounter.R.id.player3_name;
import static de.jomaway.tichuscorecounter.R.id.player4_name;
import static de.jomaway.tichuscorecounter.SetRoundPointsActivity.EXTRA_TEAM_A_SCORE;
import static de.jomaway.tichuscorecounter.SetRoundPointsActivity.EXTRA_TEAM_B_SCORE;

public class SetPlayersActivity extends AppCompatActivity {
    private static final String TAG = "SetPlayersActivity";

    public final static String EXTRA_PLAYER1 = "de.jomaway.tichuscorecounter.PLAYER1";
    public final static String EXTRA_PLAYER2 = "de.jomaway.tichuscorecounter.PLAYER2";
    public final static String EXTRA_PLAYER3 = "de.jomaway.tichuscorecounter.PLAYER3";
    public final static String EXTRA_PLAYER4 = "de.jomaway.tichuscorecounter.PLAYER4";


    EditText player1;
    EditText player2;
    EditText player3;
    EditText player4;

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

        player1 = (EditText) findViewById(R.id.player1_edit);
        player2 = (EditText) findViewById(R.id.player2_edit);
        player3 = (EditText) findViewById(R.id.player3_edit);
        player4 = (EditText) findViewById(R.id.player4_edit);

        Intent intent = getIntent();
        player1.setText(intent.getStringExtra(EXTRA_PLAYER1));
        player2.setText(intent.getStringExtra(EXTRA_PLAYER2));
        player3.setText(intent.getStringExtra(EXTRA_PLAYER3));
        player4.setText(intent.getStringExtra(EXTRA_PLAYER4));
    }

    public void done(View view){
        Log.i(TAG,"done");
        Intent returnIntent = new Intent();
        returnIntent.putExtra(EXTRA_PLAYER1, String.valueOf(player1.getText()));
        returnIntent.putExtra(EXTRA_PLAYER2, String.valueOf(player2.getText()));
        returnIntent.putExtra(EXTRA_PLAYER3, String.valueOf(player3.getText()));
        returnIntent.putExtra(EXTRA_PLAYER4, String.valueOf(player4.getText()));

        setResult(RESULT_OK,returnIntent);
        finish();
    }
}

@@ -163,16 +163,46 @@
 il.Log;%0A
+import android.view.MenuItem;%0A
 import a
@@ -1268,16 +1268,551 @@
 ayer4;%0A%0A
+    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        switch (item.getItemId()) %7B%0A            case android.R.id.home:%0A                // app icon in action bar clicked; go home%0A                Intent returnIntent = new Intent();%0A                //returnIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);%0A                setResult(RESULT_CANCELED,returnIntent);%0A                finish();%0A                return true;%0A            default:%0A                return super.onOptionsItemSelected(item);%0A        %7D%0A    %7D%0A
     @Ove

add back arrows to resultActivitys