make event end time optional, close #13
This commit is contained in:
parent
bf1558162a
commit
3749ad825a
|
@ -37,7 +37,12 @@ public class EventsAdapter extends BaseAdapter {
|
|||
final Event event = mEvents.get(position);
|
||||
viewHolder.eventTitle.setText(event.getTitle());
|
||||
viewHolder.eventStart.setText(Formatter.getTime(event.getStartTS()));
|
||||
viewHolder.eventEnd.setText(Formatter.getTime(event.getEndTS()));
|
||||
|
||||
if (event.getStartTS() == event.getEndTS()) {
|
||||
viewHolder.eventEnd.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
viewHolder.eventEnd.setText(Formatter.getTime(event.getEndTS()));
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
private static DateTime mEventEndDateTime;
|
||||
private static Event mEvent;
|
||||
private static boolean mWasReminderInit;
|
||||
private static boolean mWasEndDateSet;
|
||||
private static boolean mWasEndTimeSet;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -77,6 +79,9 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
updateEndDate();
|
||||
updateEndTime();
|
||||
setupReminder();
|
||||
|
||||
mWasEndDateSet = (event != null);
|
||||
mWasEndTimeSet = (event != null);
|
||||
}
|
||||
|
||||
private void setupEditEvent() {
|
||||
|
@ -91,7 +96,7 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
private void setupNewEvent(String dayCode) {
|
||||
setTitle(getResources().getString(R.string.new_event));
|
||||
mEventStartDateTime = Formatter.getDateTimeFromCode(dayCode).withZoneRetainFields(DateTimeZone.getDefault()).withHourOfDay(13);
|
||||
mEventEndDateTime = Formatter.getDateTimeFromCode(dayCode).withZoneRetainFields(DateTimeZone.getDefault()).withHourOfDay(14);
|
||||
mEventEndDateTime = mEventStartDateTime;
|
||||
}
|
||||
|
||||
private void hideKeyboard() {
|
||||
|
@ -261,6 +266,9 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
||||
dateSet(year, monthOfYear, dayOfMonth, true);
|
||||
if (!mWasEndDateSet) {
|
||||
dateSet(year, monthOfYear, dayOfMonth, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -268,6 +276,9 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
timeSet(hourOfDay, minute, true);
|
||||
if (!mWasEndTimeSet) {
|
||||
timeSet(hourOfDay, minute, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -292,6 +303,7 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
} else {
|
||||
mEventEndDateTime = mEventEndDateTime.withYear(year).withMonthOfYear(month + 1).withDayOfMonth(day);
|
||||
updateEndDate();
|
||||
mWasEndDateSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,6 +314,7 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio
|
|||
} else {
|
||||
mEventEndDateTime = mEventEndDateTime.withHourOfDay(hours).withMinuteOfHour(minutes);
|
||||
updateEndTime();
|
||||
mWasEndTimeSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<string name="details">Dettagli</string>
|
||||
<string name="title">Titolo</string>
|
||||
<string name="start">Inizio</string>
|
||||
<string name="end">Fine</string>
|
||||
<string name="end">Fine (facoltativo)</string>
|
||||
<string name="description">Descrizione</string>
|
||||
|
||||
<!-- About -->
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<string name="details">詳細</string>
|
||||
<string name="title">タイトル</string>
|
||||
<string name="start">開始</string>
|
||||
<string name="end">終了</string>
|
||||
<string name="end">終了 (任意)</string>
|
||||
<string name="description">説明</string>
|
||||
|
||||
<!-- About -->
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<string name="details">Detaljer</string>
|
||||
<string name="title">Titel</string>
|
||||
<string name="start">Start</string>
|
||||
<string name="end">Slut</string>
|
||||
<string name="end">Slut (frivillig)</string>
|
||||
<string name="description">Beskrivning</string>
|
||||
|
||||
<!-- About -->
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<string name="details">Details</string>
|
||||
<string name="title">Title</string>
|
||||
<string name="start">Start</string>
|
||||
<string name="end">End</string>
|
||||
<string name="end">End (optional)</string>
|
||||
<string name="description">Description</string>
|
||||
|
||||
<!-- About -->
|
||||
|
|
Loading…
Reference in New Issue