| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package com.example.yiupang.freefoodfinder;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.TextView;
- import android.support.v7.app.AppCompatActivity;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.Locale;
- public class EventDetailsScreen extends AppCompatActivity
- {
- String selectedEventName;
- TextView nameText;
- int success;
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_event_details_screen);
- SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
- 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");
- TextView timeLabel = (TextView) findViewById(R.id.timelabel);
- timeLabel.setVisibility(View.GONE);
- TextView dateText = (TextView) findViewById(R.id.datetext);
- dateText.setVisibility(View.GONE);
- nameText = (TextView) findViewById(R.id.nameText);
- nameText.setText(selectedEventName);
- TextView timeText = (TextView) findViewById(R.id.timeText);
- timeText.setText(selectedEventTime == null ? "TBA" :
- dayFormat.format(new Date(Long.parseLong(selectedEventTime))));
- TextView placeText = (TextView) findViewById(R.id.placeText);
- placeText.setText(selectedEventPlace == null || "".equals(selectedEventPlace) ?
- "TBA" : selectedEventPlace);
- TextView foodText = (TextView) findViewById(R.id.foodText);
- foodText.setText(selectedEventFoodType);
- TextView descText = (TextView) findViewById( R.id.descText);
- descText.setText(selectedEventDesc);
- if(selectedEventDesc != null && selectedEventFoodType != null
- && selectedEventPlace != null && selectedEventTime != null
- && selectedEventName != null)
- {
- success = 1;
- }
- else
- {
- success = 0;
- }
- }
- }
|