From 412b2d69431430c4ae231ae599b5065603d8cffa Mon Sep 17 00:00:00 2001 From: Petru Date: Sun, 14 Jul 2013 23:37:07 +0300 Subject: [PATCH] Adds method to get information from add event layout. work in progress --- src/ro/ieval/unical/AddEventActivity.java | 22 +++++++++++++++++++++- src/ro/ieval/unical/Event.java | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ro/ieval/unical/AddEventActivity.java b/src/ro/ieval/unical/AddEventActivity.java index 3526d65..976f4eb 100644 --- a/src/ro/ieval/unical/AddEventActivity.java +++ b/src/ro/ieval/unical/AddEventActivity.java @@ -13,6 +13,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.DatePicker; +import android.widget.EditText; import android.widget.TextView; import android.widget.TimePicker; @@ -67,12 +68,31 @@ public final class AddEventActivity extends Activity implements OnDateSetListene case R.id.cancel: finish(); return true; + case R.id.save: + Event e = getEvent(this); + return true; default: return false; } } - public void showDateTimePickerDialog(final View v) { + private Event getEvent(final Activity v) { + //TODO get all information + final long _id=22; + final String organizer=""; + final String title=((EditText)v.findViewById(R.id.eventtitle)).getText().toString(); + final String eventLocation=""; + final String description=((EditText)v.findViewById(R.id.description)).getText().toString(); + final int eventColor=0; + final long dtstart=0; + final long dtend=0; + final long calendarID = 0; + System.out.print(title + description); + Event ret = new Event(_id,organizer,title,eventLocation,description,eventColor,dtstart,dtend,calendarID); + return ret; + } + + public void showDateTimePickerDialog(final View v) { dateTimeTextView=(TextView) v; if(v.getId()==R.id.date_start || v.getId()==R.id.date_end || v.getId() == R.id.repeat_until) new DatePickerFragment().show(getFragmentManager(), "datePicker"); diff --git a/src/ro/ieval/unical/Event.java b/src/ro/ieval/unical/Event.java index c164805..41809e9 100644 --- a/src/ro/ieval/unical/Event.java +++ b/src/ro/ieval/unical/Event.java @@ -55,7 +55,7 @@ final class Event implements Parcelable{ /** Calendar ID */ public final long calendarID; - private Event(final long _id, final String organizer, final String title, final String eventLocation, final String description, final int eventColor, final long dtstart, final long dtend, final long calendarID) { + public Event(final long _id, final String organizer, final String title, final String eventLocation, final String description, final int eventColor, final long dtstart, final long dtend, final long calendarID) { this._id=_id; this.organizer=organizer; this.title=title; -- 2.39.2