<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical" >
- <TextView
- android:id="@+id/eventTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text=""
- android:textSize="35sp"
- android:textIsSelectable="true"
- />
-
- <TextView
- android:id="@+id/date"
+ <ImageView
+ android:id="@+id/imageView1"
+ android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:selectAllOnFocus="true"
- android:textIsSelectable="true"
- android:textSize="20sp"
- />
-
- <TextView
- android:id="@+id/description"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/descriptionlabel"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:src="@android:drawable/title_bar_tall" />
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="wrap_content">
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:layout_width="0dip"
android:layout_height="wrap_content"
- android:text="@string/locationlabel"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:layout_weight="1"
+ android:orientation="vertical" >
- <TextView
- android:id="@+id/location"
- android:layout_width="match_parent"
+ <TextView
+ android:id="@+id/startday"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+
+ <TextView
+ android:id="@+id/startdate"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ <TextView
+ android:id="@+id/starttime"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:layout_weight="1"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/endday"
+ android:gravity="right"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+
+ <TextView
+ android:id="@+id/enddate"
+ android:gravity="right"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ <TextView
+ android:id="@+id/endtime"
+ android:gravity="right"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ </LinearLayout>
</LinearLayout>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/descriptionlabel"
+ android:textStyle="bold"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+
</LinearLayout>
\ No newline at end of file
--- /dev/null
+package ro.ieval.unical;
+
+import java.util.GregorianCalendar;
+
+import android.content.Context;
+import android.content.res.Resources;
+
+public class CalendarUtils {
+ public static String DayToString(Context context, GregorianCalendar gc) {
+ int dc=gc.get(GregorianCalendar.DAY_OF_WEEK);
+ if(dc==GregorianCalendar.SUNDAY) return context.getString(R.string.sunday);
+ else if(dc==GregorianCalendar.MONDAY) return context.getString(R.string.monday);
+ else if(dc==GregorianCalendar.TUESDAY) return context.getString(R.string.tuesday);
+ else if(dc==GregorianCalendar.WEDNESDAY) return context.getString(R.string.wednesday);
+ else if(dc==GregorianCalendar.THURSDAY) return context.getString(R.string.thursday);
+ else if(dc==GregorianCalendar.FRIDAY) return context.getString(R.string.friday);
+ else return context.getString(R.string.saturday);
+ }
+}
package ro.ieval.unical;
+import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.GregorianCalendar;
import android.app.Activity;
import android.content.Context;
super.onCreate(savedInstanceState);
final Event e=getIntent().getParcelableExtra(EXTRA_EVENT);
setContentView(R.layout.event_view);
+ setTitle(e.title);
- final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
- final TextView date=(TextView) findViewById(R.id.date);
- final TextView description=(TextView) findViewById(R.id.description);
- final TextView location= (TextView) findViewById(R.id.location);
-
- eventTitle.setText(e.title);
- date.setText(new Date(e.dtstart).toString());
- description.setText(e.description);
- location.setText(e.eventLocation);
+ final TextView startday= (TextView) findViewById(R.id.startday);
+ final TextView endday= (TextView) findViewById(R.id.endday);
+ final TextView startdate= (TextView) findViewById(R.id.startdate);
+ final TextView enddate= (TextView) findViewById(R.id.enddate);
+ final TextView starttime= (TextView) findViewById(R.id.starttime);
+ final TextView endtime= (TextView) findViewById(R.id.endtime);
+
+ GregorianCalendar cstart = new GregorianCalendar();
+ cstart.setTime(new Date(e.dtstart));
+ GregorianCalendar cend = new GregorianCalendar();
+ cend.setTime(new Date(e.dtend));
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat stf = new SimpleDateFormat("kk:mm:ss");
+
+ startday.setText(CalendarUtils.DayToString(this,cstart));
+ if(CalendarUtils.DayToString(this,cstart)!=CalendarUtils.DayToString(this, cend))
+ endday.setText(CalendarUtils.DayToString(this, cend));
+ startdate.setText(sdf.format(cstart.getTime()));
+ if(sdf.format(cstart.getTime())!=sdf.format(cend.getTime()))
+ enddate.setText(sdf.format(cend.getTime()));
+ starttime.setText(stf.format(cstart.getTime()));
+ endtime.setText(stf.format(cend.getTime()));
}
@Override