Enhancement Complete

Still need to add locale strings for translation of 'today'
This commit is contained in:
jeubank12 2016-03-26 13:42:46 -05:00 committed by Phillip Thelen
parent 7aa2e4238a
commit 8de649b7e0
2 changed files with 19 additions and 12 deletions

View file

@ -272,6 +272,7 @@ To start, which parts of your life do you want to improve?</string>
<string name="ago_minutes" formatted="false">%d minutes ago</string>
<string name="ago_hours" formatted="false">%d hours ago</string>
<string name="ago_1hour">1 hour ago</string>
<string name="today">Today</string>
<string name="sidebar_items">Items</string>
<string name="eggs">Eggs</string>
<string name="hatching_potions">Hatching Potions</string>
@ -286,4 +287,4 @@ To start, which parts of your life do you want to improve?</string>
<string name="armoireNotesFull" formatted="false">Open the Armoire to randomly receive special Equipment, Experience, or food! Equipment pieces remaining: %d</string>
<string name="armoireLastItem">You\'ve found the last piece of rare Equipment in the Enchanted Armoire.</string>
<string name="armoireNotesEmpty">The Armoire will have new Equipment in the first week of every month. Until then, keep clicking for Experience and Food!</string>
</resources>
</resources>

View file

@ -430,7 +430,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
}
}
private class DateEditTextListener implements View.OnClickListener {
private class DateEditTextListener implements View.OnClickListener, DatePickerDialog.OnDateSetListener {
Calendar calendar;
DatePickerDialog datePickerDialog;
EditText datePickerText;
@ -442,31 +442,37 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
this.datePickerText = dateText;
this.datePickerText.setOnClickListener(this);
this.dateFormatter = DateFormat.getDateInstance();
// TODO add a today button
this.datePickerDialog = new DatePickerDialog(datePickerText.getContext(), new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
calendar.set(year, monthOfYear, dayOfMonth);
updateDateText();
}
}, calendar.get(Calendar.YEAR),
this.datePickerDialog = new DatePickerDialog(datePickerText.getContext(), this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH));
this.datePickerDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getResources().getString(R.string.today), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setCalendar(Calendar.getInstance().getTime());
}
});
updateDateText();
}
public void onClick(View view) {
datePickerDialog.show();
}
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
calendar.set(year, monthOfYear, dayOfMonth);
updateDateText();
}
public Calendar getCalendar() {
return (Calendar) calendar.clone();
}
public void setCalendar(Date date) {
calendar.setTime(date);
datePickerDialog.updateDate(calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH));
updateDateText();
}