Use different title in task edit when task is a new task

pull/14/head
Sam Bosley 14 years ago
parent 09d5f6918c
commit bf9ed3d039

@ -441,6 +441,8 @@
<string name="TEA_date_and_time">Date/Time</string> <string name="TEA_date_and_time">Date/Time</string>
<string name="TEA_new_task">New Task</string>
<string name="WSV_click_to_load">Tap me to search for ways to get this done!</string> <string name="WSV_click_to_load">Tap me to search for ways to get this done!</string>
<string name="WSV_not_online">I can do more when connected to the Internet. Please check your connection.</string> <string name="WSV_not_online">I can do more when connected to the Internet. Please check your connection.</string>

@ -32,6 +32,12 @@ public class TaskEditActivity extends AstridActivity {
((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.TAd_contextEditTask); ((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.TAd_contextEditTask);
} }
public void updateTitle(boolean isNewTask) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null)
((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(isNewTask ? R.string.TEA_new_task : R.string.TAd_contextEditTask);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see android.support.v4.app.FragmentActivity#onResume() * @see android.support.v4.app.FragmentActivity#onResume()
*/ */

@ -222,7 +222,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
// --- other instance variables // --- other instance variables
/** true if editing started with a new task */ /** true if editing started with a new task */
boolean isNewTask = false; private boolean isNewTask = false;
/** task model */ /** task model */
Task model = null; Task model = null;
@ -716,7 +716,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
protected void loadItem(Intent intent) { protected void loadItem(Intent intent) {
if (model != null) { if (model != null) {
// came from bundle // came from bundle
isNewTask = (model.getValue(Task.TITLE).length() == 0); setIsNewTask(model.getValue(Task.TITLE).length() == 0);
return; return;
} }
@ -747,7 +747,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
if (model.getValue(Task.TITLE).length() == 0) { if (model.getValue(Task.TITLE).length() == 0) {
StatisticsService.reportEvent(StatisticsConstants.CREATE_TASK); StatisticsService.reportEvent(StatisticsConstants.CREATE_TASK);
isNewTask = true; setIsNewTask(true);
// set deletion date until task gets a title // set deletion date until task gets a title
model.setValue(Task.DELETION_DATE, DateUtilities.now()); model.setValue(Task.DELETION_DATE, DateUtilities.now());
@ -767,6 +767,16 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
private void setIsNewTask(boolean isNewTask) {
this.isNewTask = isNewTask;
if (isNewTask) {
Activity activity = getActivity();
if (activity instanceof TaskEditActivity) {
((TaskEditActivity) activity).updateTitle(isNewTask);
}
}
}
/** Convenience method to populate fields after setting model to null */ /** Convenience method to populate fields after setting model to null */
public void repopulateFromScratch(Intent intent) { public void repopulateFromScratch(Intent intent) {
model = null; model = null;

Loading…
Cancel
Save