]>
Commit | Line | Data |
---|---|---|
1 | package ro.ieval.unical; | |
2 | ||
3 | import android.app.ActionBar; | |
4 | import android.app.ActionBar.Tab; | |
5 | import android.app.Fragment; | |
6 | import android.app.FragmentTransaction; | |
7 | ||
8 | public class AddEventTabListener implements ActionBar.TabListener { | |
9 | public Fragment fragment; | |
10 | private Event ev; | |
11 | int tabId; | |
12 | ||
13 | public AddEventTabListener(final Fragment fragment,Event e,int tabId) { | |
14 | this.fragment = fragment; | |
15 | this.ev = e; | |
16 | this.tabId=tabId; | |
17 | } | |
18 | ||
19 | @Override | |
20 | public void onTabSelected(final Tab tab, final FragmentTransaction ft) { | |
21 | ft.replace(R.id.fragment_container, fragment); | |
22 | } | |
23 | ||
24 | @Override | |
25 | public void onTabUnselected(final Tab tab, final FragmentTransaction ft) { | |
26 | switch (tabId) { | |
27 | case 0: | |
28 | ev.title=fragment.getView().findViewById(R.id.eventtitle).toString(); | |
29 | break; | |
30 | case 1: | |
31 | ev.description=fragment.getView().findViewById(R.id.description).toString(); | |
32 | break; | |
33 | case 2: | |
34 | break; | |
35 | } | |
36 | ft.remove(fragment); | |
37 | } | |
38 | ||
39 | @Override | |
40 | public void onTabReselected(final Tab tab, final FragmentTransaction ft) { | |
41 | // TODO Auto-generated method stub | |
42 | ||
43 | } | |
44 | } |