]> iEval git - unical.git/commitdiff
Cleanup previous commit
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 9 Jun 2013 11:41:59 +0000 (14:41 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 9 Jun 2013 11:41:59 +0000 (14:41 +0300)
src/ro/ieval/unical/Attendee.java
src/ro/ieval/unical/DeleteEventDialog.java
src/ro/ieval/unical/DisplayEventActivity.java
src/ro/ieval/unical/EventListActivity.java
src/ro/ieval/unical/LoginActivity.java
src/ro/ieval/unical/MainActivity.java

index ede40d4bb0d69d76cf10806fd72313b72e604514..d6cb4ff8b86954597cd66e92db4c95a8859ee4e0 100644 (file)
@@ -4,7 +4,6 @@ import android.content.ContentResolver;
 import android.content.Context;
 import android.database.Cursor;
 import android.provider.BaseColumns;
-import android.provider.CalendarContract;
 import android.provider.CalendarContract.Attendees;
 
 final class Attendee {
index 2783a8ca1e47cb5ec4e61df557fc176a77504f8a..a07650765c638a38f342502134ec2893b8bf4a88 100644 (file)
@@ -13,12 +13,13 @@ public final class DeleteEventDialog extends DialogFragment {
         builder.setMessage(R.string.askdeleteevent)
                .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
-                               public void onClick(final DialogInterface dialog, final int id) {
+                   public void onClick(final DialogInterface dialog, final int id) {
+
                    }
                })
                .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
                    @Override
-                               public void onClick(final DialogInterface dialog, final int id) {
+                   public void onClick(final DialogInterface dialog, final int id) {
                        // User cancelled the dialog
                    }
                });
index 8b8a767afdb805c586d7bac200378fa9e14c7b5e..47f82a6b499f725dd51a6fe83cf0e075e4d8361f 100644 (file)
@@ -15,7 +15,6 @@ public class DisplayEventActivity extends Activity {
        public static final String EXTRA_EVENT = "event";
 
        public static void displayEvent(final Context context, final Event event){
-               System.out.println("Muie");
                final Intent i=new Intent(context,DisplayEventActivity.class);
                i.putExtra(DisplayEventActivity.EXTRA_EVENT, event);
                context.startActivity(i);
index 24732602009bb2377fd9aaa29561aa3c6f176e3e..17b219a320895777fc6e6165a210bf3dc2b0e5df 100644 (file)
@@ -1,11 +1,9 @@
 package ro.ieval.unical;
 
 import java.util.Arrays;
-import java.util.Date;
-import java.util.GregorianCalendar;
+import java.util.Comparator;
 
 import android.app.Activity;
-import android.content.Intent;
 import android.graphics.Color;
 import android.os.Bundle;
 import android.view.View;
@@ -15,41 +13,38 @@ import android.widget.LinearLayout;
 
 
 public class EventListActivity extends Activity {
-       GregorianCalendar gc;
-       
+       private static class EventComparator implements Comparator<Event> {
+               @Override
+               public int compare(final Event lhs, final Event rhs) {
+                       if(lhs.dtstart < rhs.dtstart)
+                               return -1;
+                       if(lhs.dtstart == rhs.dtstart)
+                               return 0;
+                       return 1;
+               }
+
+       }
+
        @Override
-       protected void onCreate(Bundle savedInstanceState) {
-               // TODO Auto-generated method stub
+       protected void onCreate(final Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.event_list);
-               
-               Date d=new Date();
-               d.getTime();
-               gc=new GregorianCalendar();
-               gc.setTime(d);
-               
-           Event r[]=Event.getAllEvents(getBaseContext());
-           LinearLayout ll = (LinearLayout)findViewById(R.id.eventslayout);
-               Arrays.sort(r,new EventComparator());
-               EventButton[] b=new EventButton[10000];
-               for(int i=0; i<r.length; ++i) {
-                       b[i]=new EventButton(getBaseContext(),r[i]);
-                       b[i].setText(r[i].title);
-                       
-                       b[i].setTextColor(Color.BLACK);
-                       b[i].setOnClickListener(new OnClickListener() {
-                               
+
+           final Event events[]=Event.getAllEvents(getBaseContext());
+           final LinearLayout layout = (LinearLayout) findViewById(R.id.eventslayout);
+               Arrays.sort(events,new EventComparator());
+               for(final Event event : events) {
+                       final Button button=new Button(this);
+                       button.setText(event.title);
+
+                       button.setTextColor(Color.BLACK);
+                       button.setOnClickListener(new OnClickListener() {
                                @Override
-                               public void onClick(View v) {
-                                       // TODO Auto-generated method stub
-                                       EventButton b=(EventButton) v;
-                                       DisplayEventActivity.displayEvent(EventListActivity.this,b.e);
-                                       //Intent i=new Intent(getBaseContext(),DisplayEventActivity.class);
-                                       //i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-                                       //startActivity(i);
+                               public void onClick(final View v) {
+                                       DisplayEventActivity.displayEvent(EventListActivity.this, event);
                                }
                        });
-                       ll.addView(b[i]);
+                       layout.addView(button);
                }
        }
        
index 8c958be3894c129e9e3288efa193a268be6b5ab5..3dd36366fe731f27fac4fc4f2b01f1fc1c9cd1f4 100644 (file)
@@ -4,7 +4,6 @@ import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
-import android.widget.EditText;
 
 public final class LoginActivity extends Activity {
        
@@ -14,8 +13,8 @@ public final class LoginActivity extends Activity {
                setContentView(R.layout.login);
                setTitle(R.string.log_in);
 
-               final EditText user=(EditText) findViewById(R.id.editText1);
-               final EditText pass=(EditText) findViewById(R.id.editText2);
+               //final EditText user=(EditText) findViewById(R.id.editText1);
+               //final EditText pass=(EditText) findViewById(R.id.editText2);
                final Button logIn=(Button) findViewById(R.id.button1);
        
                logIn.setOnClickListener(new View.OnClickListener() {
index b70649e1be1816b4117bdf4bced87e02477eb358..2584500769c37da272c1b062047da50c89871656 100644 (file)
@@ -20,10 +20,8 @@ public class MainActivity extends android.app.Activity {
                        startActivity(i);
                }
 
-               //DisplayEventActivity.displayEvent(this, Event.getEventsByCalendar(this,
-               //              Calendar.getAllCalendars(this)[0]._id, Events.DTSTART)[0]);
-               Intent i=new Intent(this,EventListActivity.class);
-               startActivity(i);
+               final Intent intent=new Intent(this, EventListActivity.class);
+               startActivity(intent);
        }
        
        @Override
This page took 0.034608 seconds and 4 git commands to generate.