]> iEval git - unical.git/commitdiff
adds beautiful interface for adding events
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Tue, 11 Jun 2013 09:55:32 +0000 (12:55 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Tue, 11 Jun 2013 09:55:32 +0000 (12:55 +0300)
13 files changed:
res/layout/add_event.xml
res/layout/add_event_basic_tab.xml [new file with mode: 0644]
res/layout/add_event_details_tab.xml [new file with mode: 0644]
res/layout/add_event_other_tab.xml [new file with mode: 0644]
res/menu/add_event.xml [new file with mode: 0644]
res/menu/main.xml
res/values/strings.xml
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/AddEventBasicTabFragment.java [new file with mode: 0644]
src/ro/ieval/unical/AddEventDetailsTabFragment.java [new file with mode: 0644]
src/ro/ieval/unical/AddEventOtherTabFragment.java [new file with mode: 0644]
src/ro/ieval/unical/AddEventTabListener.java [new file with mode: 0644]
src/ro/ieval/unical/EventListActivity.java

index 6840e24971178cb4b2bd7cfa1c8e4cf8ff8345c5..885c616853c2f7d156ca16c2ad13a2cbf1725654 100644 (file)
@@ -1,52 +1,13 @@
-<?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
diff --git a/res/layout/add_event_basic_tab.xml b/res/layout/add_event_basic_tab.xml
new file mode 100644 (file)
index 0000000..6eb886e
--- /dev/null
@@ -0,0 +1,18 @@
+<?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>
diff --git a/res/layout/add_event_details_tab.xml b/res/layout/add_event_details_tab.xml
new file mode 100644 (file)
index 0000000..10d8b77
--- /dev/null
@@ -0,0 +1,18 @@
+<?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>
diff --git a/res/layout/add_event_other_tab.xml b/res/layout/add_event_other_tab.xml
new file mode 100644 (file)
index 0000000..c71af2d
--- /dev/null
@@ -0,0 +1,12 @@
+<?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>
diff --git a/res/menu/add_event.xml b/res/menu/add_event.xml
new file mode 100644 (file)
index 0000000..67850a8
--- /dev/null
@@ -0,0 +1,7 @@
+<?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>
index 6cc0074d67a3ade7f3c64c723862781ce6f84784..799568d49daf386e2b311991d06989a8609e7829 100644 (file)
@@ -1,6 +1,6 @@
 <?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">
index 21090792eb51b64096449c14d68bf9559ff1e69a..7f54470c70cb5cb9e2111de51c779c298ec13a35 100644 (file)
     <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>
@@ -32,4 +38,4 @@
         <item>Monthly</item>
         <item>Yearly</item>
     </string-array>
-</resources>
+</resources>
\ No newline at end of file
index 95b66a30ef4dac9349b933e4949ac7167ca69df6..0fc26ab477c6eeb54e93d37032fe3474b86f1918 100644 (file)
@@ -1,6 +1,16 @@
 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
@@ -8,5 +18,40 @@ public final class AddEventActivity extends Activity {
                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;
+               }
        }
 }
diff --git a/src/ro/ieval/unical/AddEventBasicTabFragment.java b/src/ro/ieval/unical/AddEventBasicTabFragment.java
new file mode 100644 (file)
index 0000000..53596d2
--- /dev/null
@@ -0,0 +1,16 @@
+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);
+    }
+}
diff --git a/src/ro/ieval/unical/AddEventDetailsTabFragment.java b/src/ro/ieval/unical/AddEventDetailsTabFragment.java
new file mode 100644 (file)
index 0000000..20def85
--- /dev/null
@@ -0,0 +1,15 @@
+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);
+    }
+}
diff --git a/src/ro/ieval/unical/AddEventOtherTabFragment.java b/src/ro/ieval/unical/AddEventOtherTabFragment.java
new file mode 100644 (file)
index 0000000..5e28544
--- /dev/null
@@ -0,0 +1,15 @@
+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);
+    }
+}
diff --git a/src/ro/ieval/unical/AddEventTabListener.java b/src/ro/ieval/unical/AddEventTabListener.java
new file mode 100644 (file)
index 0000000..1a4661a
--- /dev/null
@@ -0,0 +1,30 @@
+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
+               
+       }
+}
index c9ccd445fbac4c6e2276d06e9ba80ce79a40e439..67e0a7f06b8d8e5c85cf2e8badcc3f5774f9398e 100644 (file)
@@ -75,7 +75,7 @@ public class EventListActivity extends Activity {
        @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;
This page took 0.051625 seconds and 4 git commands to generate.