-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <TabHost
- android:id="@android:id/tabhost"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
- </TabWidget>
-
- <FrameLayout
- android:id="@android:id/tabcontent"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
- <LinearLayout
- android:id="@+id/tab1"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/tab2"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/tab3"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- </LinearLayout>
- </FrameLayout>
- </LinearLayout>
- </TabHost>
-
+<LinearLayout
+xmlns:android="http://schemas.android.com/apk/res/android"
+android:orientation="vertical"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent" android:layout_gravity="center">
+ <LinearLayout
+ android:orientation="vertical"
+ android:id="@+id/fragment_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+</LinearLayout>
</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <EditText
+ android:inputType="text"
+ android:id="@+id/eventtitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="@string/eventname"
+ android:ems="10" >
+
+ <requestFocus />
+ </EditText>
+
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <EditText
+ android:id="@+id/description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:hint="@string/description"
+ android:inputType="textMultiLine" >
+
+ <requestFocus />
+ </EditText>
+
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <RatingBar
+ android:id="@+id/ratingBar1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:id="@+id/save" android:icon="@android:drawable/ic_menu_save" android:title="@string/save" android:titleCondensed="SAVE" android:showAsAction="always"></item>
+ <item android:id="@+id/cancel" android:icon="@android:drawable/ic_menu_close_clear_cancel" android:title="@string/cancel" android:titleCondensed="CANCEL" android:showAsAction="ifRoom"></item>
+
+
+</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:id="@+id/NewEvent" android:title="New event"
+ <item android:id="@+id/add_event" android:title="@string/new_event"
android:visible="true" android:showAsAction="always"
android:icon="@android:drawable/ic_menu_add"
android:titleCondensed="NEW">
<string name="friday">Friday</string>
<string name="saturday">Saturday</string>
<string name="save">Save</string>
+ <string name="addevtab1">Basic info</string>
+ <string name="addevtab2">Details</string>
+ <string name="addevtab3">Other</string>
+ <string name="eventname">Event Name</string>
+ <string name="cancel">Cancel</string>
+ <string name="new_event">New Event</string>
<string-array name="Repeat">
<item>Daily</item>
<item>Monthly</item>
<item>Yearly</item>
</string-array>
-</resources>
+</resources>
\ No newline at end of file
package ro.ieval.unical;
+import android.app.ActionBar;
import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
+import android.app.ActionBar.Tab;
+import android.content.Intent;
import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.widget.TabHost;
+import android.widget.TabHost.TabSpec;
public final class AddEventActivity extends Activity {
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.add_event);
setTitle(R.string.addeventtitle);
+ ActionBar actionBar = getActionBar();
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ ActionBar.Tab t1 = actionBar.newTab().setText(this.getString(R.string.addevtab1));
+ ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2));
+ ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3));
+
+ Fragment f1 = new AddEventBasicTabFragment();
+ Fragment f2 = new AddEventDetailsTabFragment();
+ Fragment f3 = new AddEventOtherTabFragment();
+
+ t1.setTabListener(new AddEventTabListener(f1));
+ t2.setTabListener(new AddEventTabListener(f2));
+ t3.setTabListener(new AddEventTabListener(f3));
+
+ actionBar.addTab(t1);
+ actionBar.addTab(t2);
+ actionBar.addTab(t3);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(final Menu menu) {
+ final MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.add_event, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(final MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.cancel:
+ finish();
+ return true;
+ default:
+ return false;
+ }
}
}
--- /dev/null
+package ro.ieval.unical;
+import ro.ieval.unical.R;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+
+public class AddEventBasicTabFragment extends Fragment {
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.add_event_basic_tab, container, false);
+ }
+}
--- /dev/null
+package ro.ieval.unical;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class AddEventDetailsTabFragment extends Fragment {
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.add_event_details_tab, container, false);
+ }
+}
--- /dev/null
+package ro.ieval.unical;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class AddEventOtherTabFragment extends Fragment {
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.add_event_other_tab, container, false);
+ }
+}
--- /dev/null
+package ro.ieval.unical;
+
+import android.app.ActionBar;
+import android.app.ActionBar.Tab;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
+
+public class AddEventTabListener implements ActionBar.TabListener {
+ public Fragment fragment;
+
+ public AddEventTabListener(Fragment fragment) {
+ this.fragment = fragment;
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ ft.replace(R.id.fragment_container, fragment);
+ }
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+ ft.remove(fragment);
+ }
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+ // TODO Auto-generated method stub
+
+ }
+}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
- case R.id.NewEvent:
+ case R.id.add_event:
final Intent i=new Intent(this,AddEventActivity.class);
startActivity(i);
return true;