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