]> iEval git - unical.git/commitdiff
Removes repeat layout. Format date now works correctly
authorPetru <l3asketballplayer@yahoo.com>
Sun, 25 Aug 2013 18:18:44 +0000 (21:18 +0300)
committerPetru <l3asketballplayer@yahoo.com>
Sun, 25 Aug 2013 18:18:44 +0000 (21:18 +0300)
res/layout/add_event.xml
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/Utils.java

index c1f73add6ca5bbdbe7509d062e191e61fdf238fb..d9f2adf45abc151a1c1c5b6439cb2429a09bde6b 100644 (file)
 
             <requestFocus />
         </EditText>
-        <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/repeat"
-                android:layout_weight="1"
-                android:textAppearance="?android:attr/textAppearanceMedium" />
-
-        <Switch
-                android:id="@+id/repeat_switch"
-                android:layout_weight="1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
 
     </LinearLayout>
 
-    <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:id="@+id/repeat_layout"
-            android:orientation="vertical" >
-
-        <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="left" >
-
-            <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/repeat_every"
-                    android:textAppearance="?android:attr/textAppearanceMedium" />
-
-            <EditText
-                    android:id="@+id/repeat_time"
-                    android:inputType="number"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
-
-            <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:id="@+id/repeat_count_layout"
-                android:layout_gravity="left"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" >
-
-            <Spinner
-                    android:id="@+id/repeat_type"
-                    android:entries="@array/repeat_type_array"
-                    android:layout_width="0dip"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1" />
-            <EditText
-                    android:id="@+id/repeat_count"
-                    android:inputType="number"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:visibility="gone" />
-            <TextView
-                    style="@android:style/Widget.DeviceDefault.EditText"
-                    android:id="@+id/repeat_until"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:onClick="showDateTimePickerDialog"
-                    android:ems="8"
-                    android:visibility="gone" />
-        </LinearLayout>
-    </LinearLayout>
 </LinearLayout>
         </ScrollView>
index 80f7a04d535fd04a2b634d8cb284f2ae50517216..b86dd77c30e6dc4e73a7403c6f3c801a4ed1c764 100644 (file)
@@ -26,55 +26,6 @@ import android.widget.*;
 
 public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{
 
-    private class OnCheckedChangeListener implements android.widget.CompoundButton.OnCheckedChangeListener{
-        private final LinearLayout layout;
-        public OnCheckedChangeListener(final LinearLayout layout){
-            this.layout=layout;
-        }
-
-        private class OnItemSelectedListener implements android.widget.AdapterView.OnItemSelectedListener{
-            private final View repeatCount;
-            private final View repeatUntil;
-
-            public OnItemSelectedListener(final View repeatCount, final View repeatUntil) {
-                this.repeatCount=repeatCount;
-                this.repeatUntil=repeatUntil;
-            }
-
-            @Override
-            public void onItemSelected(final AdapterView<?> whatever, final View ignored, final int pos, final long id) {
-                switch(pos){
-                    case 0:
-                        repeatCount.setVisibility(View.GONE);
-                        repeatUntil.setVisibility(View.GONE);
-                        break;
-                    case 1:
-                        repeatCount.setVisibility(View.GONE);
-                        repeatUntil.setVisibility(View.VISIBLE);
-                        break;
-                    case 2:
-                        repeatCount.setVisibility(View.VISIBLE);
-                        repeatUntil.setVisibility(View.GONE);
-                        break;
-                    default:
-                }
-            }
-
-            @Override public void onNothingSelected(final AdapterView<?> arg0) { /* do nothing */      }
-        }
-
-        @Override
-        public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
-            if(isChecked) {
-                Utils.setEnabledRecursively(layout, true);
-                final Spinner repeatType = (Spinner) findViewById(R.id.repeat_type);
-                repeatType.setOnItemSelectedListener(new OnItemSelectedListener(findViewById(R.id.repeat_count),findViewById(R.id.repeat_until)));
-            }else {
-                Utils.setEnabledRecursively(layout, false);
-            }
-        }
-    }
-
        private TextView dateTimeTextView;
     public static final String EXTRA_EVENT = "event";
     private static Event event=new Event();
@@ -95,12 +46,6 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                final ActionBar actionBar = getActionBar();
                setContentView(R.layout.add_event);
 
-               final LinearLayout layout = (LinearLayout) findViewById(R.id.repeat_layout);
-               final Switch repeatSwitch = (Switch) findViewById(R.id.repeat_switch);
-               Utils.setEnabledRecursively(layout, false);
-
-               repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener(layout));
-
                final EditText title = (EditText) findViewById(R.id.eventtitle);
         title.requestFocus();
                title.setText(event.title);
@@ -201,7 +146,7 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
 
     public void showDateTimePickerDialog(final View v) {
                dateTimeTextView=(TextView) v;
-               if(v.getId()==R.id.date_start || v.getId()==R.id.date_end || v.getId() == R.id.repeat_until){
+               if(v.getId()==R.id.date_start || v.getId()==R.id.date_end ){
                        final String[] parts = dateTimeTextView.getText().toString().split("-");
                        final DatePickerFragment fragment = new DatePickerFragment();
                        final Bundle args = new Bundle();
index 3b53b479a90cce7964136bcbaeb759055f1a6f5c..b46078aed03037b51be17dd841a70c647a5113fe 100644 (file)
@@ -27,7 +27,7 @@ final class Utils {
        }
 
        public static String formatDate(final int year, final int month, final int day){
-               return String.format(Locale.ENGLISH, "%4d-%02d-%02d", year, month, day);
+               return String.format(Locale.ENGLISH, "%4d-%02d-%02d", year, month+1, day);
        }
 
        public static void addAlarm(final Application application, final long time, final long eventId) throws SQLException{
This page took 0.028698 seconds and 4 git commands to generate.