@ -47,7 +47,6 @@ import android.view.View;
import android.view.ContextMenu.ContextMenuInfo ;
import android.view.ContextMenu.ContextMenuInfo ;
import android.view.View.OnClickListener ;
import android.view.View.OnClickListener ;
import android.view.View.OnCreateContextMenuListener ;
import android.view.View.OnCreateContextMenuListener ;
import android.widget.Button ;
import android.widget.EditText ;
import android.widget.EditText ;
import android.widget.ImageButton ;
import android.widget.ImageButton ;
import android.widget.ListView ;
import android.widget.ListView ;
@ -447,48 +446,38 @@ public class TaskListSubActivity extends SubActivity {
Notifications . clearAllNotifications ( getParent ( ) , task
Notifications . clearAllNotifications ( getParent ( ) , task
. getTaskIdentifier ( ) ) ;
. getTaskIdentifier ( ) ) ;
String response ;
String [ ] strings = new String [ ] {
if ( Preferences . shouldShowNags ( getParent ( ) ) ) {
r . getString ( R . string . notify_yes ) ,
String [ ] responses = r . getStringArray ( R . array . reminder_responses ) ;
r . getString ( R . string . notify_done ) ,
response = responses [ new Random ( ) . nextInt ( responses . length ) ] ;
r . getString ( R . string . notify_snooze ) ,
} else
r . getString ( R . string . notify_no )
response = r . getString ( R . string . taskList_nonag_reminder ) ;
} ;
AlertDialog dialog = new AlertDialog . Builder ( getParent ( ) ) . setTitle (
R . string . taskView_notifyTitle ) . setMessage (
task . getName ( ) + "\n\n" + response ) . setIcon (
android . R . drawable . ic_dialog_alert )
// yes, i will do it: just closes this dialog
. setPositiveButton ( R . string . notify_yes , null )
// no, i will ignore: quits application
new AlertDialog . Builder ( getParent ( ) ) . setTitle (
. setNegativeButton ( R . string . notify_no ,
task . getName ( ) ) . setIcon (
new DialogInterface . OnClickListener ( ) {
android . R . drawable . ic_dialog_info )
public void onClick ( DialogInterface d , int which ) {
. setSingleChoiceItems ( strings , 0 , new DialogInterface . OnClickListener ( ) {
@Override
public void onClick ( DialogInterface dialog , int which ) {
switch ( which ) {
case 0 :
break ;
case 1 :
task . setProgressPercentage ( TaskModelForList . COMPLETE_PERCENTAGE ) ;
getTaskController ( ) . saveTask ( task , false ) ;
break ;
case 2 :
snoozeAlert ( task , repeatInterval , flags ) ;
break ;
case 3 :
TaskList . shouldCloseInstance = true ;
TaskList . shouldCloseInstance = true ;
closeActivity ( ) ;
closeActivity ( ) ;
break ;
}
}
} )
dialog . dismiss ( ) ;
// snooze: sets a new temporary alert, closes application
. setNeutralButton ( R . string . notify_snooze ,
new DialogInterface . OnClickListener ( ) {
public void onClick ( DialogInterface d , int which ) {
snoozeAlert ( task , repeatInterval , flags ) ;
}
}
} )
} )
. create ( ) ;
. show ( ) ;
Button button = new Button ( getParent ( ) ) ;
button . setText ( R . string . notify_done ) ;
button . setOnClickListener ( new OnClickListener ( ) {
@Override
public void onClick ( View arg0 ) {
task . setProgressPercentage ( TaskModelForList . COMPLETE_PERCENTAGE ) ;
getTaskController ( ) . saveTask ( task , false ) ;
}
} ) ;
dialog . addContentView ( button , null ) ;
dialog . show ( ) ;
}
}
/ * *
/ * *
@ -591,7 +580,7 @@ public class TaskListSubActivity extends SubActivity {
if ( Thread . interrupted ( ) )
if ( Thread . interrupted ( ) )
return ;
return ;
TaskModelForList task = i . next ( ) ;
final TaskModelForList task = i . next ( ) ;
if ( ! filterShowDone ) {
if ( ! filterShowDone ) {
if ( task . isTaskCompleted ( ) ) {
if ( task . isTaskCompleted ( ) ) {
@ -687,7 +676,8 @@ public class TaskListSubActivity extends SubActivity {
} catch ( final Exception e ) {
} catch ( final Exception e ) {
AstridUtilities . reportFlurryError ( "task-list-error" , e ) ;
AstridUtilities . reportFlurryError ( "task-list-error" , e ) ;
Log . e ( "astrid" , "Error loading task list" , e ) ;
Log . e ( "astrid" , "Error loading task list" , e ) ;
// DialogUtilities.okDialog(getParent(), "Error loading task list: " + e.getMessage() + ".\n\nOffending line: " + e.getStackTrace()[0], null);
DialogUtilities . okDialog ( getParent ( ) , "Error loading task list: " + e . getMessage ( ) + ".\n\nOffending line: " + e . getStackTrace ( ) [ 0 ] , null ) ;
onTaskListLoaded ( ) ;
return ;
return ;
}
}