@ -135,6 +135,11 @@ public class ProjectFragment extends Fragment implements InitAndSetListener {
. setTitle ( StrUtil . format ( "确定要删除 [{}]" , item . getProjectName ( ) ) )
. setTitle ( StrUtil . format ( "确定要删除 [{}]" , item . getProjectName ( ) ) )
. setIcon ( new IconicsDrawable ( getContext ( ) ) . icon ( Ionicons . Icon . ion_android_warning ) . color ( Color . RED ) )
. setIcon ( new IconicsDrawable ( getContext ( ) ) . icon ( Ionicons . Icon . ion_android_warning ) . color ( Color . RED ) )
. setPositiveButton ( "确定" , ( dialog , which ) - > {
. setPositiveButton ( "确定" , ( dialog , which ) - > {
// 是否级联删除打卡项
confirmDeleteProjectRecord ( item ) ;
XLog . d ( "删除 {} 打卡项" , item . getProjectName ( ) ) ;
// 删除
// 删除
deleteProject ( item ) ;
deleteProject ( item ) ;
// 更新视图
// 更新视图
@ -147,6 +152,21 @@ public class ProjectFragment extends Fragment implements InitAndSetListener {
return true ;
return true ;
}
}
private void confirmDeleteProjectRecord ( ProjectIcon item ) {
// 再次弹出是否级联删除选项
AlertDialog projectItemAlertDialog = new AlertDialog . Builder ( getContext ( ) )
. setTitle ( StrUtil . format ( "是否要删除 [{}] 已打卡记录?" , item . getProjectName ( ) ) )
. setIcon ( new IconicsDrawable ( getContext ( ) ) . icon ( Ionicons . Icon . ion_android_warning ) . color ( Color . RED ) )
. setPositiveButton ( "确定" , ( dialog , which ) - > {
XLog . d ( "删除 {} 已打卡记录" , item . getProjectName ( ) ) ;
DBManager . INSTANCE . recordDao ( ) . deleteByProjectId ( item . getId ( ) ) ;
} )
. setNegativeButton ( "取消" , ( ( dialog , which ) - > dialog . dismiss ( ) ) )
. create ( ) ;
projectItemAlertDialog . show ( ) ;
}
} ) ;
} ) ;
}
}