소스 검색

Fix editText in event details

Fernando Diaz 9 년 전
부모
커밋
ed8478df87

+ 0 - 46
app/src/main/java/com/example/yiupang/freefoodfinder/EventDetailsScreen.java

@@ -1,46 +0,0 @@
-package com.example.yiupang.freefoodfinder;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-
-/**
- * Created by bryanmcguffin on 5/25/17.
- */
-
-/**
- * This class loads the details pertaining to some selected event.
- * That event is passed in either from the map or from the event list screen.
- */
-public class EventDetailsScreen extends Fragment
-{
-    private Event e = null;
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-    {
-        View view = inflater.inflate(R.layout.event_details_screen, container, false);
-
-
-
-
-        return view;
-    }
-
-    /**
-     * Call this to give the details screen a new event.
-     *
-     * @param evt The event to be displayed
-     */
-    /*public void captureNewEvent(Event evt)
-    {
-        e = evt;
-    }*/
-}

+ 10 - 0
app/src/main/java/com/example/yiupang/freefoodfinder/EventDetailsScreen1.java

@@ -26,6 +26,8 @@ public class EventDetailsScreen1 extends AppCompatActivity
        // Event selectedEvent = (Event)getIntent().getSerializableExtra("selectedEvent");
 
         String selectedEventName = (String)getIntent().getExtras().getSerializable("selectedEventName");
+        String selectedEventTime = (String)getIntent().getExtras().getSerializable("selectedEventTime");
+        String selectedEventPlace = (String)getIntent().getExtras().getSerializable("selectedEventPlace");
         String selectedEventDesc = (String)getIntent().getExtras().getSerializable("selectedEventDesc");
         String selectedEventFoodType = (String)getIntent().getExtras().getSerializable("selectedEventFoodType");
 
@@ -33,12 +35,20 @@ public class EventDetailsScreen1 extends AppCompatActivity
         TextView nameText = (TextView) findViewById(R.id.nameText);
         nameText.setText(selectedEventName);
 
+        TextView timeText = (TextView) findViewById(R.id.timeText);
+        timeText.setText(selectedEventTime);
+
+        TextView placeText = (TextView) findViewById(R.id.placeText);
+        placeText.setText(selectedEventPlace);
+
         TextView foodText = (TextView) findViewById(R.id.foodText);
         foodText.setText(selectedEventFoodType);
 
         TextView descText = (TextView) findViewById( R.id.descText);
         descText.setText(selectedEventDesc);
 
+
+
        /* Log.d("NAME", selectedEventName);
         Log.d("DESCRIPTION", selectedEventDesc);
         Log.d("FOODTYPE", selectedEventFoodType); */

+ 2 - 5
app/src/main/java/com/example/yiupang/freefoodfinder/EventsScreen.java

@@ -54,14 +54,9 @@ public class EventsScreen extends Fragment
             public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
             {
                 Event selectedEvent = (Event) adapterView.getAdapter().getItem(position);
-               /* Log.d("tag", selectedEvent.getName());
-                Log.d("tag", selectedEvent.getFoodType());
-                Log.d("tag", selectedEvent.getDescription()); */
 
                 switchActivity(selectedEvent);
 
-               /* EventDetailsScreen es = new EventDetailsScreen();
-                getFragmentManager().beginTransaction().replace(R.id.frame, es).commit();*/
             }
         });
     }
@@ -71,6 +66,8 @@ public class EventsScreen extends Fragment
         Intent details = new Intent(getContext(), EventDetailsScreen1.class);
 
         details.putExtra("selectedEventName", selectedEvent.getName());
+        details.putExtra("selectedEventTime", selectedEvent.getTime());
+        details.putExtra("selectedEventPlace", selectedEvent.getPlace());
         details.putExtra("selectedEventDesc", selectedEvent.getDescription());
         details.putExtra("selectedEventFoodType", selectedEvent.getFoodType());
 

+ 8 - 8
app/src/main/res/layout/activity_event_details_screen1.xml

@@ -5,7 +5,7 @@
     android:orientation="vertical">
 
 
-    <EditText
+    <TextView
         android:id="@+id/creatorlabel"
         android:layout_width="80dp"
         android:layout_height="wrap_content"
@@ -13,7 +13,7 @@
         android:inputType="textPersonName"
         android:text="Creator:" />
 
-    <EditText
+    <TextView
         android:id="@+id/datelabel"
         android:layout_width="66dp"
         android:layout_height="wrap_content"
@@ -21,7 +21,7 @@
         android:inputType="textPersonName"
         android:text="Date:" />
 
-    <EditText
+    <TextView
         android:id="@+id/timelabel"
         android:layout_width="68dp"
         android:layout_height="wrap_content"
@@ -29,7 +29,7 @@
         android:inputType="textPersonName"
         android:text="Time:" />
 
-    <EditText
+    <TextView
         android:id="@+id/placelabel"
         android:layout_width="70dp"
         android:layout_height="wrap_content"
@@ -37,7 +37,7 @@
         android:inputType="textPersonName"
         android:text="Place:" />
 
-    <EditText
+    <TextView
         android:id="@+id/foodlabel"
         android:layout_width="115dp"
         android:layout_height="wrap_content"
@@ -45,7 +45,7 @@
         android:inputType="textPersonName"
         android:text="Food Served:" />
 
-    <EditText
+    <TextView
         android:id="@+id/desclabel"
         android:layout_width="105dp"
         android:layout_height="wrap_content"
@@ -63,7 +63,7 @@
         android:inputType="textPersonName" />
 
     <TextView
-        android:id="@+id/timetext"
+        android:id="@+id/timeText"
         android:layout_width="255dp"
         android:layout_height="wrap_content"
         android:layout_column="1"
@@ -81,7 +81,7 @@
         android:inputType="textPersonName" />
 
     <TextView
-        android:id="@+id/placetext"
+        android:id="@+id/placeText"
         android:layout_width="255dp"
         android:layout_height="wrap_content"
         android:layout_column="1"

+ 0 - 110
app/src/main/res/layout/event_details_screen.xml

@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-
-    <EditText
-        android:id="@+id/creatorlabel"
-        android:layout_width="80dp"
-        android:layout_height="wrap_content"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="Creator:" />
-
-    <EditText
-        android:id="@+id/datelabel"
-        android:layout_width="66dp"
-        android:layout_height="wrap_content"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="Date:" />
-
-    <EditText
-        android:id="@+id/timelabel"
-        android:layout_width="68dp"
-        android:layout_height="wrap_content"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="Time:" />
-
-    <EditText
-        android:id="@+id/placelabel"
-        android:layout_width="70dp"
-        android:layout_height="wrap_content"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="Place:" />
-
-    <EditText
-        android:id="@+id/foodlabel"
-        android:layout_width="115dp"
-        android:layout_height="wrap_content"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="Food Served:" />
-
-    <EditText
-        android:id="@+id/desclabel"
-        android:layout_width="105dp"
-        android:layout_height="wrap_content"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="Description:" />
-
-    <EditText
-        android:id="@+id/creatortext"
-        android:layout_width="255dp"
-        android:layout_height="wrap_content"
-        android:layout_column="1"
-        android:layout_row="0"
-        android:ems="10"
-        android:inputType="textPersonName" />
-
-    <EditText
-        android:id="@+id/timetext"
-        android:layout_width="255dp"
-        android:layout_height="wrap_content"
-        android:layout_column="1"
-        android:layout_row="2"
-        android:ems="10"
-        android:inputType="textPersonName" />
-
-    <EditText
-        android:id="@+id/datetext"
-        android:layout_width="255dp"
-        android:layout_height="wrap_content"
-        android:layout_column="1"
-        android:layout_row="1"
-        android:ems="10"
-        android:inputType="textPersonName" />
-
-    <EditText
-        android:id="@+id/placetext"
-        android:layout_width="255dp"
-        android:layout_height="wrap_content"
-        android:layout_column="1"
-        android:layout_row="3"
-        android:ems="10"
-        android:inputType="textPersonName" />
-
-    <EditText
-        android:id="@+id/foodtext"
-        android:layout_width="255dp"
-        android:layout_height="wrap_content"
-        android:layout_column="1"
-        android:layout_row="4"
-        android:ems="10"
-        android:inputType="textPersonName" />
-
-    <EditText
-        android:id="@+id/descriptiontext"
-        android:layout_width="255dp"
-        android:layout_height="wrap_content"
-        android:layout_column="1"
-        android:layout_row="5"
-        android:ems="10"
-        android:inputType="textPersonName" />
-
-</GridLayout>