]> iEval git - unical.git/commitdiff
Clean up previous commit and tabify source files
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 10 Jun 2013 14:06:49 +0000 (17:06 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 10 Jun 2013 14:06:49 +0000 (17:06 +0300)
src/ro/ieval/unical/CalendarUtils.java [deleted file]
src/ro/ieval/unical/DeleteEventDialog.java
src/ro/ieval/unical/DisplayEventActivity.java
src/ro/ieval/unical/EventAdapter.java
src/ro/ieval/unical/EventListActivity.java
src/ro/ieval/unical/MainActivity.java
src/ro/ieval/unical/MySQLiteHelper.java

diff --git a/src/ro/ieval/unical/CalendarUtils.java b/src/ro/ieval/unical/CalendarUtils.java
deleted file mode 100644 (file)
index 40489a9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package ro.ieval.unical;
-
-import java.util.GregorianCalendar;
-
-import android.content.Context;
-import android.content.res.Resources;
-
-public class CalendarUtils {
-       public static String DayToString(Context context, GregorianCalendar gc) {
-               int dc=gc.get(GregorianCalendar.DAY_OF_WEEK);
-               if(dc==GregorianCalendar.SUNDAY) return context.getString(R.string.sunday);
-               else if(dc==GregorianCalendar.MONDAY) return context.getString(R.string.monday);
-               else if(dc==GregorianCalendar.TUESDAY) return context.getString(R.string.tuesday);
-               else if(dc==GregorianCalendar.WEDNESDAY) return context.getString(R.string.wednesday);
-               else if(dc==GregorianCalendar.THURSDAY) return context.getString(R.string.thursday);
-               else if(dc==GregorianCalendar.FRIDAY) return context.getString(R.string.friday);
-               else return context.getString(R.string.saturday);
-       }
-}
index a07650765c638a38f342502134ec2893b8bf4a88..8dc2267e43626d8fe11fda4e7f68c7a1b98a2612 100644 (file)
@@ -8,21 +8,21 @@ import android.os.Bundle;
 
 public final class DeleteEventDialog extends DialogFragment {
        @Override
-    public Dialog onCreateDialog(final Bundle savedInstanceState) {
-        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-        builder.setMessage(R.string.askdeleteevent)
-               .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
-                   @Override
-                   public void onClick(final DialogInterface dialog, final int id) {
+       public Dialog onCreateDialog(final Bundle savedInstanceState) {
+               final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+               builder.setMessage(R.string.askdeleteevent)
+                          .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+                                  @Override
+                                  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) {
-                       // User cancelled the dialog
-                   }
-               });
-        return builder.create();
-    }
+                                  }
+                          })
+                          .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+                                  @Override
+                                  public void onClick(final DialogInterface dialog, final int id) {
+                                          // User cancelled the dialog
+                                  }
+                          });
+               return builder.create();
+       }
 }
index 8055ec131fa3040bc9cc76c31888c9f2eee68607..df885caa7c7afd8885df32589f0a0e03062cd5fd 100644 (file)
@@ -2,7 +2,7 @@ package ro.ieval.unical;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import android.app.Activity;
 import android.content.Context;
@@ -29,55 +29,54 @@ public class DisplayEventActivity extends Activity {
                setContentView(R.layout.event_view);
                setTitle(e.title);
                
-           final TextView startday= (TextView) findViewById(R.id.startday);
-           final TextView endday= (TextView) findViewById(R.id.endday);
-           final TextView startdate= (TextView) findViewById(R.id.startdate);
-           final TextView enddate= (TextView) findViewById(R.id.enddate);
-           final TextView starttime= (TextView) findViewById(R.id.starttime);
-           final TextView endtime= (TextView) findViewById(R.id.endtime);
-           
-           GregorianCalendar cstart = new GregorianCalendar();
-           cstart.setTime(new Date(e.dtstart));
-           GregorianCalendar cend = new GregorianCalendar();
-           cend.setTime(new Date(e.dtend));
-           SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
-           SimpleDateFormat stf = new SimpleDateFormat("kk:mm:ss");
-           
-           startday.setText(CalendarUtils.DayToString(this,cstart));
-           if(CalendarUtils.DayToString(this,cstart)!=CalendarUtils.DayToString(this, cend))
-               endday.setText(CalendarUtils.DayToString(this, cend));
-           startdate.setText(sdf.format(cstart.getTime()));
-           if(sdf.format(cstart.getTime())!=sdf.format(cend.getTime()))
-               enddate.setText(sdf.format(cend.getTime()));
-           starttime.setText(stf.format(cstart.getTime()));
-           endtime.setText(stf.format(cend.getTime()));
+               final TextView startDay= (TextView) findViewById(R.id.startday);
+               final TextView endDay= (TextView) findViewById(R.id.endday);
+               final TextView startDate= (TextView) findViewById(R.id.startdate);
+               final TextView endDate= (TextView) findViewById(R.id.enddate);
+               final TextView startTime= (TextView) findViewById(R.id.starttime);
+               final TextView endTime= (TextView) findViewById(R.id.endtime);
+               
+               final Date start=new Date(e.dtstart);
+               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);
+               
+               startDay.setText(dayOfWeekFormat.format(start));
+               if(dayOfWeekFormat.format(start)!=dayOfWeekFormat.format(end))
+                       endDay.setText(dayOfWeekFormat.format(end));
+               startDate.setText(dateFormat.format(start));
+               if(dateFormat.format(start)!=dateFormat.format(end))
+                       endDate.setText(dateFormat.format(end));
+               startTime.setText(timeFormat.format(start));
+               endTime.setText(timeFormat.format(end));
        }
        
        @Override
        public boolean onCreateOptionsMenu(final Menu menu) {
                final MenuInflater inflater = getMenuInflater();
-           inflater.inflate(R.menu.event, menu);
+               inflater.inflate(R.menu.event, menu);
                return true;
        }
        
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
-           // Handle item selection
-           switch (item. getItemId()) {
-               case R.id.NewEvent:
-                       final Intent i=new Intent(this,AddEventActivity.class);
+               // Handle item selection
+               switch (item. getItemId()) {
+                       case R.id.NewEvent:
+                               final Intent i=new Intent(this,AddEventActivity.class);
                                startActivity(i);
-                   return true;
-               case R.id.deleteevent:
-                       final DeleteEventDialog d=new DeleteEventDialog();
-                       d.show(getFragmentManager(), "Delete");
-                       return true;
-               case R.id.eventlist:
-                       final Intent it=new Intent(this,EventListActivity.class);
-                       startActivity(it);
-                       return true;
-               default:
-                   return true;
-           }
+                               return true;
+                       case R.id.deleteevent:
+                               final DeleteEventDialog d=new DeleteEventDialog();
+                               d.show(getFragmentManager(), "Delete");
+                               return true;
+                       case R.id.eventlist:
+                               final Intent it=new Intent(this,EventListActivity.class);
+                               startActivity(it);
+                               return true;
+                       default:
+                               return true;
+               }
        }
 }
index b06e08a38fe06b3d3272b5fc0eb71032c5574304..7aa48338c6e01db21d9369210284d3c3e0edbae8 100644 (file)
@@ -21,18 +21,18 @@ public class EventAdapter extends ArrayAdapter<Event> {
        
        @Override
        public View getView(final int position, final View convertView, final ViewGroup parent) {
-           final LayoutInflater inflater = (LayoutInflater) context
-               .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-           final View rowView = inflater.inflate(R.layout.event_row_layout, parent, false);
-           final TextView title = (TextView) rowView.findViewById(R.id.smalleventtitle);
-           final TextView dstart = (TextView) rowView.findViewById(R.id.smalldatestart);
-           final TextView dend = (TextView) rowView.findViewById(R.id.smalldateend);
-           final View header = rowView.findViewById(R.id.rowHeader);
-           header.setBackgroundColor(values[position].eventColour);
-           title.setText(values[position].title);
-           dstart.setText(new Date(values[position].dtstart).toString());
-           dend.setText(new Date(values[position].dtend).toString());
-           
-           return rowView;
+               final LayoutInflater inflater = (LayoutInflater) context
+                       .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+               final View rowView = inflater.inflate(R.layout.event_row_layout, parent, false);
+               final TextView title = (TextView) rowView.findViewById(R.id.smalleventtitle);
+               final TextView dstart = (TextView) rowView.findViewById(R.id.smalldatestart);
+               final TextView dend = (TextView) rowView.findViewById(R.id.smalldateend);
+               final View header = rowView.findViewById(R.id.rowHeader);
+               header.setBackgroundColor(values[position].eventColour);
+               title.setText(values[position].title);
+               dstart.setText(new Date(values[position].dtstart).toString());
+               dend.setText(new Date(values[position].dtend).toString());
+               
+               return rowView;
         }
 }
index cb2ee6d71ca69c46c892226ae833ad15889c2af1..c9ccd445fbac4c6e2276d06e9ba80ce79a40e439 100644 (file)
@@ -18,14 +18,13 @@ import android.widget.ListView;
 
 public class EventListActivity extends Activity {
        
-       long dtstart,dtend;
        //Used to refresh events if the user wants to display only certain events
        //Sry for bad english
        //Muie la comisie
        private void displayEvents() {
                final Event events[]=Event.getAllEvents(getBaseContext());
-           final ListView lv = (ListView) findViewById(R.id.eventlist);
-           
+               final ListView lv = (ListView) findViewById(R.id.eventlist);
+               
                Arrays.sort(events,new EventComparator());
                int idx=-1;//index of the first event to be displayed
                for(int i=0; i<events.length; ++i) 
@@ -69,20 +68,20 @@ public class EventListActivity extends Activity {
        @Override
        public boolean onCreateOptionsMenu(final Menu menu) {
                final MenuInflater inflater = getMenuInflater();
-           inflater.inflate(R.menu.main, menu);
+               inflater.inflate(R.menu.main, menu);
                return true;
        }
        
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
-           switch (item.getItemId()) {
-               case R.id.NewEvent:
-                       final Intent i=new Intent(this,AddEventActivity.class);
+               switch (item.getItemId()) {
+                       case R.id.NewEvent:
+                               final Intent i=new Intent(this,AddEventActivity.class);
                                startActivity(i);
-                   return true;
-               default:
-                   return false;
-           }
+                               return true;
+                       default:
+                               return false;
+               }
        }
        
 }
index 2584500769c37da272c1b062047da50c89871656..b779d069ce91e0f88eab68b3bff54e1d927a8065 100644 (file)
@@ -27,19 +27,19 @@ public class MainActivity extends android.app.Activity {
        @Override
        public boolean onCreateOptionsMenu(final Menu menu) {
                final MenuInflater inflater = getMenuInflater();
-           inflater.inflate(R.menu.main, menu);
+               inflater.inflate(R.menu.main, menu);
                return true;
        }
        
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
-           switch (item.getItemId()) {
-               case R.id.NewEvent:
-                       final Intent i=new Intent(this,AddEventActivity.class);
+               switch (item.getItemId()) {
+                       case R.id.NewEvent:
+                               final Intent i=new Intent(this,AddEventActivity.class);
                                startActivity(i);
-                   return true;
-               default:
-                   return false;
-           }
+                               return true;
+                       default:
+                               return false;
+               }
        }
 }
index ac5372473fc2b312e24128fa76d74f8268046ae6..dbadca58e89af64f5497ccff38c71824c9c9de64 100644 (file)
@@ -47,10 +47,10 @@ public class MySQLiteHelper extends SQLiteOpenHelper {
        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);
+                               "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
This page took 0.048829 seconds and 4 git commands to generate.