From: Petru Trimbitas Date: Thu, 23 May 2013 08:43:31 +0000 (+0300) Subject: First real commit X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=bdd8f09cf842a79c5b667632d2866f38e366a86c;p=unical.git First real commit --- diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..a4763d1 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ec69fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +gen/ \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..6760bcd --- /dev/null +++ b/.project @@ -0,0 +1,33 @@ + + + Unical + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b080d2d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..621590d --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ic_launcher-web.png b/ic_launcher-web.png new file mode 100644 index 0000000..a256e1c Binary files /dev/null and b/ic_launcher-web.png differ diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar new file mode 100644 index 0000000..65ebaf8 Binary files /dev/null and b/libs/android-support-v4.jar differ diff --git a/libs/gson-2.2.4-javadoc.jar b/libs/gson-2.2.4-javadoc.jar new file mode 100644 index 0000000..ce8fa7d Binary files /dev/null and b/libs/gson-2.2.4-javadoc.jar differ diff --git a/libs/gson-2.2.4-sources.jar b/libs/gson-2.2.4-sources.jar new file mode 100644 index 0000000..30b13f6 Binary files /dev/null and b/libs/gson-2.2.4-sources.jar differ diff --git a/libs/gson-2.2.4.jar b/libs/gson-2.2.4.jar new file mode 100644 index 0000000..9478253 Binary files /dev/null and b/libs/gson-2.2.4.jar differ diff --git a/proguard-project.txt b/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..21e5f60 --- /dev/null +++ b/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-17 +android.library.reference.1=../gridlayout_v7 diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..f48ba3e Binary files /dev/null and b/res/drawable-hdpi/ic_launcher.png differ diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..3ff2b76 Binary files /dev/null and b/res/drawable-mdpi/ic_launcher.png differ diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..774763e Binary files /dev/null and b/res/drawable-xhdpi/ic_launcher.png differ diff --git a/res/drawable-xxhdpi/ic_launcher.png b/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..32da992 Binary files /dev/null and b/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/res/layout/eventview.xml b/res/layout/eventview.xml new file mode 100644 index 0000000..218fae9 --- /dev/null +++ b/res/layout/eventview.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml new file mode 100644 index 0000000..541752f --- /dev/null +++ b/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml new file mode 100644 index 0000000..f20e015 --- /dev/null +++ b/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..3b009ce --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Unical + + \ No newline at end of file diff --git a/res/values/styles.xml b/res/values/styles.xml new file mode 100644 index 0000000..4a10ca4 --- /dev/null +++ b/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/ro/ieval/unical/Constants.java b/src/ro/ieval/unical/Constants.java new file mode 100644 index 0000000..031ea59 --- /dev/null +++ b/src/ro/ieval/unical/Constants.java @@ -0,0 +1,8 @@ +package ro.ieval.unical; + + +public class Constants { + public static String searchUrl="https://unical.ieval.ro/search"; + public static String user="asd"; + public static String password="asd"; +} diff --git a/src/ro/ieval/unical/DatabaseInteract.java b/src/ro/ieval/unical/DatabaseInteract.java new file mode 100644 index 0000000..a4d2580 --- /dev/null +++ b/src/ro/ieval/unical/DatabaseInteract.java @@ -0,0 +1,26 @@ +package ro.ieval.unical; + +import android.content.Context; +import android.database.SQLException; +import android.database.sqlite.SQLiteDatabase; + +public class DatabaseInteract { + private SQLiteDatabase database; + private MySQLiteHelper dbHelper; + + public DatabaseInteract(Context context) { + dbHelper = new MySQLiteHelper(context); + } + + public void open() throws SQLException { + database=dbHelper.getWritableDatabase(); + } + + public void close() { + dbHelper.close(); + } + + //Add event + //Delete event + //Search event +} diff --git a/src/ro/ieval/unical/Event.java b/src/ro/ieval/unical/Event.java new file mode 100644 index 0000000..8d99947 --- /dev/null +++ b/src/ro/ieval/unical/Event.java @@ -0,0 +1,12 @@ +package ro.ieval.unical; +public class Event { + public int date,time; + public boolean repeat; + public int repeatInterval; + public String location; + public String description; + public String tags[]; + public String title; + Event() { + } +} diff --git a/src/ro/ieval/unical/MySQLiteHelper.java b/src/ro/ieval/unical/MySQLiteHelper.java new file mode 100644 index 0000000..889ebda --- /dev/null +++ b/src/ro/ieval/unical/MySQLiteHelper.java @@ -0,0 +1,58 @@ +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; + +public class MySQLiteHelper extends SQLiteOpenHelper { + public static final String Name="Events"; + + public static final String ID = "_id"; + public static final String name = "Name"; + public static final String description = "Description"; + public static final String date = "Date"; + public static final String time = "Time"; + public static final String repeat = "repeat"; + public static final String repeatIn = "repeatInterval"; + public static final String location = "Location"; + + private static final int dbversion=1; + + private static final String Database_create = "create table " + Name + "(" + + ID + " integer primary key autoincrement, " + + name + " text not null, " + + description + " text, " + + date + " integer, " + + time + " integer, " + + repeat + " integer, "+ + repeatIn + " integer, " + + location + " text);" + ; + + public MySQLiteHelper(Context context) { + super(context,Name, null, dbversion); + // TODO Auto-generated constructor stub + } + + @Override + public void onCreate(SQLiteDatabase db) { + // TODO Auto-generated method stub + db.execSQL(Database_create); + + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + // TODO Auto-generated method stub + Log.w(MySQLiteHelper.class.getName(), + "Upgrading database from version " + oldVersion + " to " + + newVersion + ", which will destroy all old data"); + db.execSQL("DROP TABLE IF EXISTS " + Name); + onCreate(db); + } + +} \ No newline at end of file diff --git a/src/ro/ieval/unical/mainActivity.java b/src/ro/ieval/unical/mainActivity.java new file mode 100644 index 0000000..eba4604 --- /dev/null +++ b/src/ro/ieval/unical/mainActivity.java @@ -0,0 +1,72 @@ +package ro.ieval.unical; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.Date; + +import ro.ieval.unical.R; +import com.google.gson.Gson; + +import android.graphics.Color; +import android.os.Bundle; +import android.os.Handler; +import android.util.Base64; +import android.widget.EditText; +import android.widget.TextView; + + +public class mainActivity extends android.app.Activity { + Event[] getEventList() { + Event events[]; + URL hostUrlJson; + InputStreamReader in; + try { + hostUrlJson=new URL(Constants.searchUrl); + URLConnection calConnection = hostUrlJson.openConnection(); + calConnection.setRequestProperty("Authorization", "Basic "+Base64.encodeToString( (Constants.user+':'+Constants.password).getBytes(), Base64.NO_WRAP)); + in = new InputStreamReader(calConnection.getInputStream()); + Gson gson=new Gson(); + events=gson.fromJson(in,Event[].class); + in.close(); + return events; + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + System.err.println("catch1"); + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + System.err.println("catch2"); + e.printStackTrace(); + } + throw new AssertionError(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + // All Begins here :) + // And here it began the olympic app that does olympic thing + 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); + System.err.println("MuieLaComisie"); + final Handler h=new Handler(); + new Thread(new Runnable() { + public void run() { + final Event events[]=getEventList(); + 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); + } + }); + } + }).start(); + } +}