add event work in progress
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Thu, 13 Jun 2013 13:52:55 +0000 (16:52 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Thu, 13 Jun 2013 13:52:55 +0000 (16:52 +0300)
res/layout/add_event_basic_tab.xml
res/values/strings.xml
src/ro/ieval/unical/TrivialFragment.java

index 1f7ea5d6c0be86a1f0f11b95a3725ebd9e198495..f05f666ee851a5543253dfe753b0665001bdc3c8 100644 (file)
         android:layout_height="wrap_content"
         android:id="@+id/repeat_layout"
         android:orientation="vertical" >
-        
-           <Spinner
-               android:id="@+id/repeat_spinner"
-               android:entries="@array/repeat_array"
-               android:layout_width="match_parent"
-               android:layout_height="wrap_content"
-         />
            
            <LinearLayout
-               android:layout_width="match_parent"
-               android:layout_height="wrap_content" >
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_gravity="left" >
        
                <TextView
-                   android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/repeat_every"
                    android:textAppearance="?android:attr/textAppearanceMedium" />
        
                <EditText
-                   android:id="@+id/editText1"
+                   android:id="@+id/repeat_time"
                    android:layout_width="0dip"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
-                   android:ems="10"
+                   android:ems="4"
+                   android:text="1"
                    android:inputType="number" />
        
-               <TextView
-                   android:id="@+id/textView2"
-                   android:layout_width="wrap_content"
-                   android:layout_height="wrap_content"
-                   android:text="Medium Text"
-                   android:textAppearance="?android:attr/textAppearanceMedium" />
+               <Spinner
+                       android:id="@+id/repeat_spinner"
+                       android:entries="@array/repeat_array_p"
+                       android:layout_width="match_parent"
+                       android:layout_height="wrap_content"
+               />
        
            </LinearLayout>
        
            <LinearLayout
-               android:layout_width="match_parent"
+               android:id="@+id/repeat_count_layout"
+               android:layout_gravity="left"
+               android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
        
                <Spinner
index 289dde350a0393b65615990d852598e87a58b39c..9c1ca70ef9a281c5c76b71129eaaa640519f26a4 100644 (file)
     <string name="end_label">End: </string>
     <string name="repeat">Repeat</string>
     <string name="repeat_every">Repeat every</string>
+    <string name="day">day</string>
+    <string name="days">days</string>
+    <string name="week">week</string>
+    <string name="weeks">weeks</string>
+    <string name="month">month</string>
+    <string name="months">months</string>
+    <string name="year">year</string>
+    <string name="years">years</string>
 
-    <string-array name="repeat_array">
-        <item>Daily</item>
-        <item>Weekly</item>
-        <item>Monthly</item>
-        <item>Yearly</item>
+    <string-array name="repeat_array_s">
+        <item>Day</item>
+        <item>Week</item>
+        <item>Month</item>
+        <item>Year</item>
+    </string-array>
+    <string-array name="repeat_array_p">
+        <item>Days</item>
+        <item>Weeks</item>
+        <item>Months</item>
+        <item>Years</item>
     </string-array>
     <string-array name="repeat_type_array">
         <item>Forever</item>
index 3de4ed48ece35316ce24b5408f04a3e394d50925..1dc538f23e1eda41ae0acb387532debc583376e3 100644 (file)
@@ -2,10 +2,14 @@ package ro.ieval.unical;
 
 import android.app.Fragment;
 import android.os.Bundle;
+import android.text.InputType;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.CompoundButton;
+import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.Spinner;
 import android.widget.Switch;
@@ -29,6 +33,32 @@ public final class TrivialFragment extends Fragment {
                                public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
                                        if(isChecked) {
                                                Utils.setEnabledRecursively(ll, true);
+                                               Spinner repeatType = (Spinner) view.findViewById(R.id.repeat_type);
+                                               final EditText repeatCount = new EditText(getActivity());
+                                               repeatCount.setInputType(InputType.TYPE_CLASS_NUMBER);
+                                               final LinearLayout repeatLayout = (LinearLayout) view.findViewById(R.id.repeat_count_layout);
+                                               
+                                               repeatType.setOnItemSelectedListener(new OnItemSelectedListener() {
+
+                                                       @Override
+                                                       public void onItemSelected(AdapterView<?> arg0,
+                                                                       View arg1, int arg2, long arg3) {
+                                                               if(arg2==1) {
+                                                                       //TODO adauga un date picker
+                                                                       //TODO sterge repeatCount
+                                                               }else if(arg2==2) {
+                                                                       repeatLayout.addView(repeatCount);
+                                                               }else {
+                                                                       //TODO sterge repeatCount
+                                                               }
+                                                               
+                                                       }
+
+                                                       @Override
+                                                       public void onNothingSelected(AdapterView<?> arg0) {
+                                                               
+                                                       }
+                                               });
                                        }else {
                                                Utils.setEnabledRecursively(ll, false);
                                        }
This page took 0.014583 seconds and 4 git commands to generate.