]> iEval git - unical.git/commitdiff
Adds new event_view layout wich looks better. Still needs improvments
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Mon, 10 Jun 2013 10:00:59 +0000 (13:00 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Mon, 10 Jun 2013 10:00:59 +0000 (13:00 +0300)
res/layout/event_view.xml
res/values/strings.xml
src/ro/ieval/unical/CalendarUtils.java [new file with mode: 0644]
src/ro/ieval/unical/DisplayEventActivity.java
src/ro/ieval/unical/Event.java

index 72b207821f3feda4bd67edfd8493f2c977ffc46e..42b29921eb4d46dee6d8b943025c174406087466 100644 (file)
@@ -1,52 +1,79 @@
 <?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
index ed1faa212f81fb9cff2abf08cb72da5ce0b124cf..09153300dabaa80b8693b0cbb45d0be909bd0fed 100644 (file)
     <string name="no">No</string>
     <string name="askdeleteevent">Delete this event ?</string>
     <string name="addeventtitle">New Event</string>
+    <string name="sunday">Sunday</string>
+    <string name="monday">Monday</string>
+    <string name="tuesday">Tuesday</string>
+    <string name="wednesday">Wednesday</string>
+    <string name="thursday">Thursday</string>
+    <string name="friday">Friday</string>
+    <string name="saturday">Saturday</string>
     
     <string-array name="Repeat">
         <item>Daily</item>
diff --git a/src/ro/ieval/unical/CalendarUtils.java b/src/ro/ieval/unical/CalendarUtils.java
new file mode 100644 (file)
index 0000000..40489a9
--- /dev/null
@@ -0,0 +1,19 @@
+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);
+       }
+}
index 47f82a6b499f725dd51a6fe83cf0e075e4d8361f..8055ec131fa3040bc9cc76c31888c9f2eee68607 100644 (file)
@@ -1,6 +1,8 @@
 package ro.ieval.unical;
 
+import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.GregorianCalendar;
 
 import android.app.Activity;
 import android.content.Context;
@@ -25,16 +27,30 @@ public class DisplayEventActivity extends Activity {
                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
index 97ce822f498e97a6478be516df68889c83a055e4..a069a9f0cfa38d39bc9ae0d1758919765ca4f55c 100644 (file)
@@ -98,7 +98,7 @@ final class Event implements Parcelable{
                final ContentResolver cr=context.getContentResolver();
                cr.delete(Uri.withAppendedPath(Events.CONTENT_URI, Long.toString(_id)), null, null);
        }
-
+       
        @Override
        public int describeContents() {
                return 0;
This page took 0.02565 seconds and 4 git commands to generate.