diff --git a/res/values/strings.xml b/res/values/strings.xml
index 784fa08..d10b548 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -14,4 +14,5 @@
Ã…PNINGSTIDER I DAG
BILLETTERBLI MED
NYHETER
+ Kunne ikke finne kalender-app. Avbryter.
diff --git a/src/com/studentersamfundet/app/ui/EventListActivity.java b/src/com/studentersamfundet/app/ui/EventListActivity.java
index becac36..561eb24 100644
--- a/src/com/studentersamfundet/app/ui/EventListActivity.java
+++ b/src/com/studentersamfundet/app/ui/EventListActivity.java
@@ -10,7 +10,6 @@ import java.text.SimpleDateFormat;
import org.w3c.dom.NodeList;
import android.app.Dialog;
-import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -22,9 +21,8 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.ViewGroup;
import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
+import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
@@ -154,7 +152,6 @@ public class EventListActivity extends BaseDnsActivity {
/* Add onClickListeners: */
row.setOnClickListener(getShortClickListener(e));
- row.setOnLongClickListener(getLongClickListener(e));
return row;
}
@@ -260,31 +257,4 @@ public class EventListActivity extends BaseDnsActivity {
}
};
}
-
- protected OnLongClickListener getLongClickListener (final Event e) {
- return new OnLongClickListener() {
- public boolean onLongClick(View v) {
- if (e.getDate() == null)
- return false;
-
- long startDate = e.getDate().getTime();
-
- try {
- Intent intent = new Intent(Intent.ACTION_EDIT);
- intent.setType("vnd.android.cursor.item/event");
- intent.putExtra("title", e.title);
- intent.putExtra("beginTime", startDate);
- intent.putExtra("endTime", startDate + (2*60*60*1000)); // Two hours
- intent.putExtra("allDay", false);
- intent.putExtra("eventLocation", e.getLocation());
- intent.putExtra("reminder", false);
-
- startActivity(intent);
- return true;
- } catch (ActivityNotFoundException e) {
- return false;
- }
- }
- };
- }
}
diff --git a/src/com/studentersamfundet/app/ui/EventViewActivity.java b/src/com/studentersamfundet/app/ui/EventViewActivity.java
index bde8fd3..5cac0b9 100644
--- a/src/com/studentersamfundet/app/ui/EventViewActivity.java
+++ b/src/com/studentersamfundet/app/ui/EventViewActivity.java
@@ -2,6 +2,7 @@ package com.studentersamfundet.app.ui;
import java.text.SimpleDateFormat;
+import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -11,18 +12,22 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
+import android.widget.Toast;
import com.studentersamfundet.app.Event;
import com.studentersamfundet.app.R;
public class EventViewActivity extends BaseDnsActivity {
+ Event event;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.event_view);
Intent intent = getIntent();
- final Event e = (Event)intent.getSerializableExtra("event");
+ this.event = (Event)intent.getSerializableExtra("event");
+ final Event e = this.event;
if (e == null) {
throw new Error("This should NEVER happen");
@@ -67,4 +72,26 @@ public class EventViewActivity extends BaseDnsActivity {
});
}
}
+
+ public void addToCalender(View v) {
+ if (this.event.getDate() == null)
+ return;
+
+ long startDate = this.event.getDate().getTime();
+
+ try {
+ Intent intent = new Intent(Intent.ACTION_EDIT);
+ intent.setType("vnd.android.cursor.item/event");
+ intent.putExtra("title", this.event.title);
+ intent.putExtra("beginTime", startDate);
+ intent.putExtra("endTime", startDate + (2*60*60*1000)); // Two hours
+ intent.putExtra("allDay", false);
+ intent.putExtra("eventLocation", this.event.getLocation());
+ intent.putExtra("reminder", false);
+
+ startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.calendar_not_found, Toast.LENGTH_SHORT).show();
+ }
+ }
}