package se.uu.csproject.monadclient;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

public class RouteConfirmPopup extends AppCompatActivity {

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

        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
        int height = dm.heightPixels;
        getWindow().setLayout((int)(width*.9),(int)(height*.40));

        ImageButton cancel = (ImageButton)findViewById(R.id.cancelbutton);
        cancel.setOnClickListener(new View.OnClickListener() {
            public void onClick(View vw) {
                //// TODO Ilyass: maybe return to the previous activity instead of start a new one
                startActivity(new Intent(RouteConfirmPopup.this, RouteActivity.class));
            }
        });

        //TODO Stavros: store trip in user's schedule when button clicked
        Button button_confirm = (Button)findViewById(R.id.button_trip_confirm);
        button_confirm.setOnClickListener(new View.OnClickListener() {
            public void onClick(View vw) {
                startActivity(new Intent(RouteConfirmPopup.this, RouteSuccessActivity.class));
            }
        });

    }
}

@@ -62,16 +62,42 @@
 Intent;%0A
+import android.os.Bundle;%0A
 import a
@@ -141,34 +141,8 @@
 ty;%0A
-import android.os.Bundle;%0A
 impo
@@ -267,40 +267,8 @@
 ton;
-%0Aimport android.widget.TextView;
 %0A%0Apu
@@ -922,32 +922,33 @@
 lick(View vw) %7B%0A
+%0A
                 
@@ -953,30 +953,8 @@
   //
-// TODO Ilyass: maybe 
 retu
@@ -1028,79 +1028,35 @@
     
-startActivity(new Intent(RouteConfirmPopup.this, RouteActivity.class));
+finish();%0A                %0A
 %0A   
@@ -1058,32 +1058,34 @@
 %0A%0A            %7D%0A
+%0A%0A
         %7D);%0A%0A   
@@ -1471,16 +1471,21 @@
    %7D);%0A%0A
+%0A
     %7D%0A
+%0A%0A%0A%0A
 %7D%0A

return to the previous activity instead of start a new one