]>
Commit | Line | Data |
---|---|---|
1 | package ro.ieval.unical; | |
2 | import android.content.Intent; | |
3 | import android.content.SharedPreferences; | |
4 | import android.os.Bundle; | |
5 | import android.preference.PreferenceManager; | |
6 | import android.view.Menu; | |
7 | import android.view.MenuInflater; | |
8 | import android.view.MenuItem; | |
9 | ||
10 | public class MainActivity extends android.app.Activity { | |
11 | ||
12 | @Override | |
13 | protected void onCreate(final Bundle savedInstanceState) { | |
14 | super.onCreate(savedInstanceState); | |
15 | ||
16 | final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this); | |
17 | if(prefs.getBoolean("FirstTime", true)) { | |
18 | prefs.edit().putBoolean("FirstTime", false).commit(); | |
19 | final Intent i=new Intent(this,LoginActivity.class); | |
20 | startActivity(i); | |
21 | } | |
22 | ||
23 | //DisplayEventActivity.displayEvent(this, Event.getEventsByCalendar(this, | |
24 | // Calendar.getAllCalendars(this)[0]._id, Events.DTSTART)[0]); | |
25 | Intent i=new Intent(this,EventListActivity.class); | |
26 | startActivity(i); | |
27 | } | |
28 | ||
29 | @Override | |
30 | public boolean onCreateOptionsMenu(final Menu menu) { | |
31 | final MenuInflater inflater = getMenuInflater(); | |
32 | inflater.inflate(R.menu.main, menu); | |
33 | return true; | |
34 | } | |
35 | ||
36 | @Override | |
37 | public boolean onOptionsItemSelected(final MenuItem item) { | |
38 | switch (item.getItemId()) { | |
39 | case R.id.NewEvent: | |
40 | final Intent i=new Intent(this,AddEventActivity.class); | |
41 | startActivity(i); | |
42 | return true; | |
43 | default: | |
44 | return false; | |
45 | } | |
46 | } | |
47 | } |