]>
Commit | Line | Data |
---|---|---|
5cf4714f | 1 | package ro.ieval.unical; |
6d7e08bf | 2 | import android.app.ActionBar; |
5cf4714f | 3 | import android.app.Activity; |
6d7e08bf | 4 | import android.app.Fragment; |
5cf4714f | 5 | import android.os.Bundle; |
6d7e08bf PT |
6 | import android.view.Menu; |
7 | import android.view.MenuInflater; | |
8 | import android.view.MenuItem; | |
5cf4714f MG |
9 | |
10 | public final class AddEventActivity extends Activity { | |
11 | @Override | |
12 | protected void onCreate(final Bundle savedInstanceState) { | |
13 | super.onCreate(savedInstanceState); | |
14 | setContentView(R.layout.add_event); | |
ecee6932 | 15 | setTitle(R.string.addeventtitle); |
724f9857 | 16 | final ActionBar actionBar = getActionBar(); |
6d7e08bf | 17 | actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); |
724f9857 MG |
18 | final ActionBar.Tab t1 = actionBar.newTab().setText(this.getString(R.string.addevtab1)); |
19 | final ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2)); | |
20 | final ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3)); | |
6d7e08bf | 21 | |
88ba7fcf MG |
22 | final Fragment f1 = new TrivialFragment(); |
23 | final Bundle b1=new Bundle(); | |
24 | b1.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_basic_tab); | |
25 | f1.setArguments(b1); | |
26 | ||
27 | final Fragment f2 = new TrivialFragment(); | |
28 | final Bundle b2=new Bundle(); | |
29 | b2.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_details_tab); | |
30 | f2.setArguments(b2); | |
31 | ||
32 | final Fragment f3 = new TrivialFragment(); | |
33 | final Bundle b3=new Bundle(); | |
34 | b3.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_other_tab); | |
35 | f3.setArguments(b3); | |
6d7e08bf PT |
36 | |
37 | t1.setTabListener(new AddEventTabListener(f1)); | |
38 | t2.setTabListener(new AddEventTabListener(f2)); | |
39 | t3.setTabListener(new AddEventTabListener(f3)); | |
40 | ||
41 | actionBar.addTab(t1); | |
42 | actionBar.addTab(t2); | |
43 | actionBar.addTab(t3); | |
44 | } | |
45 | ||
46 | @Override | |
47 | public boolean onCreateOptionsMenu(final Menu menu) { | |
48 | final MenuInflater inflater = getMenuInflater(); | |
49 | inflater.inflate(R.menu.add_event, menu); | |
50 | return true; | |
51 | } | |
52 | ||
53 | @Override | |
54 | public boolean onOptionsItemSelected(final MenuItem item) { | |
55 | switch (item.getItemId()) { | |
56 | case R.id.cancel: | |
57 | finish(); | |
58 | return true; | |
59 | default: | |
60 | return false; | |
61 | } | |
5cf4714f MG |
62 | } |
63 | } |