--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:id="@+id/deleteevent" android:icon="@android:drawable/ic_menu_delete" android:title="Delete Event" android:visible="true" android:titleCondensed="DELETE" android:showAsAction="always"></item>
+ <item android:id="@+id/NewEvent" android:title="New event"
+ android:visible="true" android:showAsAction="ifRoom"
+ android:icon="@android:drawable/ic_menu_add"
+ android:titleCondensed="NEW">
+
+ </item>
+
+
+</menu>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:id="@+id/NewEvent" android:title="New event"
+ android:visible="true" android:showAsAction="always"
+ android:icon="@android:drawable/ic_menu_add"
+ android:titleCondensed="NEW">
+
+ </item>
+
+
+</menu>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:id="@+id/NewEvent" android:title="New event"
- android:visible="true" android:showAsAction="always"
- android:icon="@android:drawable/ic_menu_add"
- android:titleCondensed="NEW">
-
- </item>
- <item android:id="@+id/deleteevent"
- android:icon="@android:drawable/ic_menu_delete"
- android:titleCondensed="DELETE" android:title="Delete event"></item>
-
-
-</menu>
<string name="userlabel">User: </string>
<string name="passwordlabel">Pass: </string>
<string name="locationlabel">Location: </string>
- <string name="repeatlabel">Repeating </string>
+ <string name="repeatlabel">Repeating</string>
+ <string name="yes">Yes</string>
+ <string name="no">No</string>
+ <string name="askdeleteevent">Delete this event ?</string>
<string-array name="Repeat">
<item>Daily</item>
--- /dev/null
+package ro.ieval.unical;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
+public class deleteEventDialog extends DialogFragment {
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ // Use the Builder class for convenient dialog construction
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ builder.setMessage(R.string.askdeleteevent)
+ .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ // FIRE ZE MISSILES!
+ }
+ })
+ .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ // User cancelled the dialog
+ }
+ });
+ // Create the AlertDialog object and return it
+ return builder.create();
+ }
+}
import java.util.Date;
import android.app.Activity;
+import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
+import android.view.MenuItem;
import android.widget.TextView;
public class displayEventActivity extends Activity {
// TODO Auto-generated method stub
// nu stiu cum sa pun delete in loc de new event
MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.options, menu);
+ inflater.inflate(R.menu.eventmenu, menu);
return true;
}
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle item selection
+ switch (item.getItemId()) {
+ case R.id.NewEvent:
+ Intent i=new Intent(this,addEventActivity.class);
+ startActivity(i);
+ return true;
+ case R.id.deleteevent:
+ deleteEventDialog d=new deleteEventDialog();
+ d.show(getFragmentManager(), "Delete");
+ return true;
+ default:
+ return true;
+ }
+ }
}
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.provider.CalendarContract.Events;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Intent i=new Intent(this,loginActivity.class);
startActivity(i);
}
+ Intent i=new Intent(this,displayEventActivity.class);
+ Event e[]=Event.getEventsByCalendar(this, Calendar.getAllCalendars(this)[0]._id, Events.DTSTART);
+ i.putExtra(displayEventActivity.EXTRA_EVENT, e[0]);
+ startActivity(i);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.options, menu);
+ inflater.inflate(R.menu.mainmenu, menu);
return true;
}