]>
Commit | Line | Data |
---|---|---|
bdd8f09c | 1 | package ro.ieval.unical; |
7be52756 | 2 | import android.content.Intent; |
8188ed47 | 3 | import android.content.SharedPreferences; |
bdd8f09c | 4 | import android.os.Bundle; |
8188ed47 | 5 | import android.preference.PreferenceManager; |
46e6c000 | 6 | import android.provider.CalendarContract.Events; |
eb5b6684 PT |
7 | import android.view.Menu; |
8 | import android.view.MenuInflater; | |
9 | import android.view.MenuItem; | |
bdd8f09c PT |
10 | |
11 | public class mainActivity extends android.app.Activity { | |
bdd8f09c PT |
12 | |
13 | @Override | |
14 | protected void onCreate(Bundle savedInstanceState) { | |
15 | // All Begins here :) | |
16 | // And here it began the olympic app that does olympic thing | |
7be52756 | 17 | |
8188ed47 PT |
18 | //log in |
19 | super.onCreate(savedInstanceState); | |
eb5b6684 | 20 | |
8188ed47 PT |
21 | final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this); |
22 | if(prefs.getBoolean("FirstTime", true)) { | |
23 | prefs.edit().putBoolean("FirstTime", false).commit(); | |
24 | Intent i=new Intent(this,loginActivity.class); | |
25 | startActivity(i); | |
26 | } | |
46e6c000 PT |
27 | Intent i=new Intent(this,displayEventActivity.class); |
28 | Event e[]=Event.getEventsByCalendar(this, Calendar.getAllCalendars(this)[0]._id, Events.DTSTART); | |
29 | i.putExtra(displayEventActivity.EXTRA_EVENT, e[0]); | |
30 | startActivity(i); | |
bdd8f09c | 31 | } |
eb5b6684 PT |
32 | |
33 | @Override | |
34 | public boolean onCreateOptionsMenu(Menu menu) { | |
35 | // TODO Auto-generated method stub | |
36 | MenuInflater inflater = getMenuInflater(); | |
46e6c000 | 37 | inflater.inflate(R.menu.mainmenu, menu); |
eb5b6684 PT |
38 | return true; |
39 | } | |
40 | ||
41 | @Override | |
42 | public boolean onOptionsItemSelected(MenuItem item) { | |
43 | // Handle item selection | |
44 | switch (item.getItemId()) { | |
45 | case R.id.NewEvent: | |
46 | Intent i=new Intent(this,addEventActivity.class); | |
47 | startActivity(i); | |
48 | return true; | |
49 | default: | |
50 | return true; | |
51 | } | |
52 | } | |
bdd8f09c | 53 | } |