Inflation and quintessence with nonminimal coupling