From dec0e89412f5ae0e3523a76508f048edbbf80202 Mon Sep 17 00:00:00 2001
From: Petru Trimbitas <l3asketballplayer@yahoo.com>
Date: Tue, 11 Jun 2013 11:08:37 +0300
Subject: [PATCH] Day of week now displays correctly in event_view. Removes old
 add event layout

---
 res/layout/add_event.xml                      | 116 +++++-------------
 res/values/strings.xml                        |   1 +
 src/ro/ieval/unical/DisplayEventActivity.java |   8 +-
 3 files changed, 36 insertions(+), 89 deletions(-)

diff --git a/res/layout/add_event.xml b/res/layout/add_event.xml
index 002e6db..6840e24 100644
--- a/res/layout/add_event.xml
+++ b/res/layout/add_event.xml
@@ -4,103 +4,49 @@
     android:layout_height="match_parent"
     android:orientation="vertical" >
 
-    <ScrollView
-        android:id="@+id/scrollView1"
+    <TabHost
+        android:id="@android:id/tabhost"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.00" >
+        android:layout_height="match_parent" >
 
         <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:orientation="vertical" >
 
-            <LinearLayout
+            <TabWidget
+                android:id="@android:id/tabs"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="2.13" >
+                android:layout_height="wrap_content" >
+            </TabWidget>
 
-                <TextView
-                    android:id="@+id/textView1"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/title"
-                    android:textAppearance="?android:attr/textAppearanceMedium" />
-
-                <EditText
-                    android:id="@+id/editText1"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:ems="10" >
-
-                    <requestFocus />
-                </EditText>
-
-            </LinearLayout>
-
-            <TextView
-                android:id="@+id/location"
+            <FrameLayout
+                android:id="@android:id/tabcontent"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/description"
-                android:textAppearance="?android:attr/textAppearanceMedium" />
+                android:layout_height="match_parent" >
 
-            <EditText
-                android:id="@+id/editText2"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="2.13"
-                android:ems="10"
-                android:inputType="textMultiLine" />
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="2.13" >
-
-                <CheckBox
-                    android:id="@+id/checkBox1"
-                    android:layout_width="0dip"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="2.13"
-                    android:text="@string/repeatlabel" />
-
-                <Spinner
-                    android:id="@+id/spinner1"
-                    android:layout_width="213dp"
-                    android:layout_height="wrap_content" />
+                <LinearLayout
+                    android:id="@+id/tab1"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:orientation="vertical" >
+                </LinearLayout>
 
-            </LinearLayout>
+                <LinearLayout
+                    android:id="@+id/tab2"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:orientation="vertical" >
+                </LinearLayout>
 
+                <LinearLayout
+                    android:id="@+id/tab3"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:orientation="vertical" >
+                </LinearLayout>
+            </FrameLayout>
         </LinearLayout>
-
-    </ScrollView>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.00" >
-
-        <TextView
-            android:id="@+id/textView3"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/locationlabel"
-            android:textAppearance="?android:attr/textAppearanceMedium" />
-
-        <EditText
-            android:id="@+id/editText3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:ems="10" />
-
-    </LinearLayout>
-
-    <Button
-        android:id="@+id/AddEventButton"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/addeventtitle"
-    />
+    </TabHost>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0915330..2109079 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,6 +24,7 @@
     <string name="thursday">Thursday</string>
     <string name="friday">Friday</string>
     <string name="saturday">Saturday</string>
+    <string name="save">Save</string>
     
     <string-array name="Repeat">
         <item>Daily</item>
diff --git a/src/ro/ieval/unical/DisplayEventActivity.java b/src/ro/ieval/unical/DisplayEventActivity.java
index df885ca..48b8068 100644
--- a/src/ro/ieval/unical/DisplayEventActivity.java
+++ b/src/ro/ieval/unical/DisplayEventActivity.java
@@ -40,14 +40,14 @@ public class DisplayEventActivity extends Activity {
 		final Date end=new Date(e.dtend);
 		final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.UK);
 		final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.UK);
-		final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("E", Locale.UK);
+		final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
 		
 		startDay.setText(dayOfWeekFormat.format(start));
-		if(dayOfWeekFormat.format(start)!=dayOfWeekFormat.format(end))
+		if(dateFormat.format(start)!=dateFormat.format(end)) {
 			endDay.setText(dayOfWeekFormat.format(end));
-		startDate.setText(dateFormat.format(start));
-		if(dateFormat.format(start)!=dateFormat.format(end))
 			endDate.setText(dateFormat.format(end));
+		}
+		startDate.setText(dateFormat.format(start));
 		startTime.setText(timeFormat.format(start));
 		endTime.setText(timeFormat.format(end));
 	}
-- 
2.39.5