package com.example.l4z.quizapp;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;

import static com.example.l4z.quizapp.MainActivity.QUESTIONS_INTENT;

public class FinalScreenActivity extends AppCompatActivity {

    TextView pointsGained;
    ImageView email;

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

        ArrayList<String> list = getIntent().getExtras().getStringArrayList(QUESTIONS_INTENT);
        pointsGained = (TextView) findViewById(R.id.pointsGained);
        pointsGained.setText(list.get(0));
        String imageName = list.get(1);

        ImageView imageView = (ImageView) findViewById(R.id.rankImage);
        if (imageName.equals("challenger")) {
            imageView.setImageResource(R.drawable.challenger);
        } else if (imageName.equals("gold")) {
            imageView.setImageResource(R.drawable.gold_rank);
        } else if (imageName.equals("bronze")) {
            imageView.setImageResource(R.drawable.bronze_rank);
        }

        email = (ImageView)findViewById(R.id.emailImage);
        email.setOnClickListener((View.OnClickListener) v -> {
            Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
                    "mailto","WiktorKalinowski@email.com", null));
            intent.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
            intent.putExtra(Intent.EXTRA_TEXT, "body of email");
            try {
                startActivity(Intent.createChooser(intent, "Send mail..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(FinalScreenActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
            }
            startActivity(Intent.createChooser(intent, "Choose an Email client :"));
        });
    }
}

@@ -179,24 +179,56 @@
 .view.View;%0A
+import android.widget.EditText;%0A
 import andro
@@ -1465,16 +1465,152 @@
  v -%3E %7B%0A
+            EditText editText = (EditText) findViewById(R.id.feedBackText);%0A            String comment = editText.getText().toString();%0A
         
@@ -1799,24 +1799,26 @@
 T, %22
-subject of email
+Wiadomosc Quiz App
 %22);%0A
@@ -1868,23 +1868,15 @@
 XT, 
-%22body of email%22
+comment
 );%0A 

add subbit email fix