Fix previous commit
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Mon, 27 May 2013 17:40:57 +0000 (20:40 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Mon, 27 May 2013 17:40:57 +0000 (20:40 +0300)
.classpath
.settings/org.eclipse.jdt.core.prefs
AndroidManifest.xml
project.properties
res/layout/eventview.xml
res/values/strings.xml
src/ro/ieval/unical/DatabaseInteract.java
src/ro/ieval/unical/Event.java
src/ro/ieval/unical/MySQLiteHelper.java
src/ro/ieval/unical/mainActivity.java

index 5e6314e1d074759eecbdc67be253537ecd987f89..538127472825ab975c75140f2142e2dd15e0862a 100644 (file)
@@ -4,5 +4,6 @@
        <classpathentry kind="src" path="gen"/>
        <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
        <classpathentry kind="output" path="bin/classes"/>
 </classpath>
index b080d2ddc88fb0b4d7c93cd4d361c775525b4dbb..8000cd6ca6142c8827db81f47ca38a3d5d7e2eaf 100644 (file)
@@ -1,4 +1,11 @@
 eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 org.eclipse.jdt.core.compiler.source=1.6
index 621590db7b9f4d399840ce297e89fa135ec0275e..bb15f7194847bec06b62d30d0cad33e6da6bcce0 100644 (file)
@@ -7,6 +7,8 @@
         android:minSdkVersion="8"
         android:targetSdkVersion="17" />
     <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-permission android:name="android.permission.READ_CALENDAR"/>
+    <uses-permission android:name="android.permission.WRITE_CALENDAR"/>
 
     <application
         android:allowBackup="true"
@@ -19,6 +21,8 @@
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
         </activity>
+        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
+        <activity android:name="com.facebook.LoginActivity"></activity>
     </application>
 
 </manifest>
\ No newline at end of file
index a3ee5ab64f5e1901414e83e26717725e035b2aae..5efbce7d66060b4d20a5c528d4442ccd7b02f22d 100644 (file)
@@ -12,3 +12,4 @@
 
 # Project target.
 target=android-17
+android.library.reference.1=../../../../eclipse/facebook-android-sdk-3.0.1/facebook
index e462f421ef3e388a84fa43a3de854dc654520951..08d8ceef01134d7fd7b1ca394147fcd23c607c9b 100644 (file)
@@ -25,7 +25,7 @@
         />
 
     <TextView
-        android:id="@+id/desc"
+        android:id="@+id/description"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Description:"
index 3b009cea4f571a9fd11c07930e1ba460e9393175..52ff71fe2e3815e0a6b9103d7c8e158e7dd85326 100644 (file)
@@ -1,5 +1,6 @@
 <resources>
 
     <string name="app_name">Unical</string>
+    <string name="app_id">148275978690487</string>
 
 </resources>
\ No newline at end of file
index dd2dde10d17643e6365b78c8c964de7b8959a73f..520eba8c7c222e7686069117ca49867721671b2b 100644 (file)
@@ -1,7 +1,11 @@
 package ro.ieval.unical;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import android.content.ContentValues;
 import android.content.Context;
+import android.database.Cursor;
 import android.database.SQLException;
 import android.database.sqlite.SQLiteDatabase;
 
@@ -17,6 +21,7 @@ public class DatabaseInteract {
        
        public DatabaseInteract(Context context) {
                dbHelper = new MySQLiteHelper(context);
+               database=dbHelper.getWritableDatabase();
        }
        
        public void open() throws SQLException {
@@ -30,15 +35,45 @@ public class DatabaseInteract {
        //Insert event
        public void insertEvent(Event e) {
                ContentValues values = new ContentValues();
-               values.put(allColumns[1],e.title);
-               values.put(allColumns[2],e.description);
-               values.put(allColumns[3],e.date);
-               values.put(allColumns[4],e.duration);
+               values.put(allColumns[0], e._id);
+               values.put(allColumns[1], e.title);
+               values.put(allColumns[2], e.description);
+               values.put(allColumns[3], e.date);
+               values.put(allColumns[4], e.duration);
                values.put(allColumns[5], e.repeat);
                values.put(allColumns[6], e.repeatInterval);
                values.put(allColumns[7], e.location);
                database.insert(MySQLiteHelper.Name, null, values);
        }
        //Delete event
+       public void deleteEvent(String id) {
+               database.delete(MySQLiteHelper.Name, MySQLiteHelper.ID + "=" + id, null);
+       }
        //Search event
+       //Get all events
+       public List<Event> getAllEvents() {
+               List<Event> events=new ArrayList<Event>();
+               Cursor cursor=database.query(MySQLiteHelper.Name,allColumns,null,null,null,null,null);
+               
+               for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()) {
+                       Event ev=cursorToEvent(cursor);
+                       events.add(ev);
+               }
+               return events;
+       }
+
+       private Event cursorToEvent(Cursor cursor) {
+               // TODO Auto-generated method stub
+               Event e = new Event();
+               e._id=cursor.getString(0);
+               e.title=cursor.getString(1);
+               e.description=cursor.getString(2);
+               e.date=cursor.getInt(3);
+               e.duration=cursor.getInt(4);
+               if(cursor.getInt(5)==1) e.repeat=true;
+               else e.repeat=false;
+               e.repeatInterval=cursor.getInt(6);
+               e.location=cursor.getString(7);
+               return e;
+       }
 }
index d50820191a4794d13b66d719883a9f60ddc32f84..14f2c43b7a6236291958a7d36cadae20e2ed485d 100644 (file)
@@ -1,5 +1,9 @@
 package ro.ieval.unical;
+
+import android.database.Cursor;
+
 public class Event {
+       public String _id;
        public int date,duration;
        public boolean repeat;
        public int repeatInterval;
@@ -7,6 +11,18 @@ public class Event {
        public String description;
        public String tags[];
        public String title;
-       Event() {
+       Event(Cursor cursor) {
+               _id=cursor.getString(0);
+               title=cursor.getString(1);
+               description=cursor.getString(2);
+               date=cursor.getInt(3);
+               duration=cursor.getInt(4);
+               if(cursor.getInt(5)==1) repeat=true;
+               else repeat=false;
+               repeatInterval=cursor.getInt(6);
+               location=cursor.getString(7);
+       }
+       Event () {
+               
        }
 }
index dc3595157db2a37f9040b810d286a2f90b290b54..ac5372473fc2b312e24128fa76d74f8268046ae6 100644 (file)
@@ -1,10 +1,7 @@
 package ro.ieval.unical;
 
-import java.sql.SQLClientInfoException;
-
 import android.content.Context;
 import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteDatabase.CursorFactory;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.util.Log;
 
@@ -23,7 +20,8 @@ public class MySQLiteHelper extends SQLiteOpenHelper {
        private static final int dbversion=1;
        
        private static final String Database_create = "create table " + Name + "(" + 
-                       ID + " integer primary key autoincrement, " +
+                       //ID + " integer primary key autoincrement, " +
+                       ID + " text primary key, " +
                        title + " text not null, " + 
                        description + " text, " + 
                        date + " integer, " + 
index 9b9960f8c8324d618605496c9e43c777238b9b0c..8faac6623bf56904f70b673b3c3760dce2f8e8b3 100644 (file)
@@ -14,6 +14,7 @@ import javax.net.ssl.HttpsURLConnection;
 import ro.ieval.unical.R;
 import com.google.gson.Gson;
 
+import android.content.Intent;
 import android.graphics.Color;
 import android.os.Bundle;
 import android.os.Handler;
@@ -21,6 +22,9 @@ import android.util.Base64;
 import android.widget.EditText;
 import android.widget.TextView;
 
+import com.facebook.*;
+
+import com.facebook.model.*;
 
 public class mainActivity extends android.app.Activity {
        Event[] getEventList() {
@@ -63,11 +67,13 @@ public class mainActivity extends android.app.Activity {
        protected void onCreate(Bundle savedInstanceState) {
                // All Begins here :)
                // And here it began the olympic app that does olympic thing
-               setContentView(R.layout.eventview);
+               super.onCreate(savedInstanceState);
+               setContentView(R.layout.login);
+               
+               /*setContentView(R.layout.eventview);
                final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
                final TextView date=(TextView) findViewById(R.id.date);
                final TextView description=(TextView) findViewById(R.id.description);
-               super.onCreate(savedInstanceState);
 
                final Handler h=new Handler();
                new Thread(new Runnable() {
@@ -76,14 +82,14 @@ public class mainActivity extends android.app.Activity {
                                h.post(new Runnable() {
                                        public void run() {
                                                // aici incepe
+                                               
                                                eventTitle.setText(events[0].title);
                                                date.setText((new Date(events[0].date)).toString());
                                                description.setText(events[0].description);
-                                               //DatabaseInteract db=new DatabaseInteract(null);
-                                               //db.insertEvent(events[0]);
+                                               DatabaseInteract db=new DatabaseInteract(mainActivity.this);
                                        }
                                });
                        }
-               }).start();
+               }).start();*/
        }
 }
This page took 0.018992 seconds and 4 git commands to generate.