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
}
});
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;
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);
}
}
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
-import android.widget.EditText;
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() {